1
0
mirror of https://github.com/trambarhq/relaks-wordpress-example.git synced 2025-10-03 10:42:09 +02:00

Closing file after opening it, duh (issue #1).

This commit is contained in:
Chung Leong
2019-02-15 23:15:33 +01:00
parent 50d0add883
commit 36dbc7c19c

View File

@@ -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) {