mirror of
https://github.com/trambarhq/relaks-wordpress-example.git
synced 2025-10-03 02:32:02 +02:00
Closing file after opening it, duh (issue #1).
This commit is contained in:
@@ -72,9 +72,13 @@ async function loadCacheEntry(md5) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadCacheEntryKey(path) {
|
async function loadCacheEntryKey(path) {
|
||||||
let fd = await FS.openAsync(path, 'r');
|
|
||||||
let buf = Buffer.alloc(1024);
|
let buf = Buffer.alloc(1024);
|
||||||
let bytesRead = await FS.readAsync(fd, buf, 0, 1024, 0);
|
let fd = await FS.openAsync(path, 'r');
|
||||||
|
try {
|
||||||
|
await FS.readAsync(fd, buf, 0, 1024, 0);
|
||||||
|
} finally {
|
||||||
|
FS.closeAsync(fd);
|
||||||
|
}
|
||||||
let si = buf.indexOf('KEY:');
|
let si = buf.indexOf('KEY:');
|
||||||
let ei = buf.indexOf('\n', si);
|
let ei = buf.indexOf('\n', si);
|
||||||
if (si !== -1 && ei !== -1) {
|
if (si !== -1 && ei !== -1) {
|
||||||
|
Reference in New Issue
Block a user