From 2981da4d9c5887191cf66df7f730a8d50eea3024 Mon Sep 17 00:00:00 2001 From: cenguoping Date: Thu, 13 Oct 2022 14:04:04 +0800 Subject: [PATCH] =?UTF-8?q?fs.close=E4=B8=8D=E5=86=99=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=97=B6=EF=BC=8C=E5=9C=A814.x=E5=8F=8A?= =?UTF-8?q?=E4=BB=A5=E4=B8=8A=E7=89=88=E6=9C=AC=E4=B8=AD=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- binding/nodejs/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/binding/nodejs/index.js b/binding/nodejs/index.js index 0ed4896..87d0275 100644 --- a/binding/nodejs/index.js +++ b/binding/nodejs/index.js @@ -122,7 +122,7 @@ class Searcher { } } if (fd) { - fs.close(fd) + fs.close(fd,function(){}) } const diff = process.hrtime(startTime) @@ -178,7 +178,7 @@ const loadVectorIndexFromFile = dbPath => { const fd = fs.openSync(dbPath, 'r') const buffer = Buffer.alloc(VectorIndexLength) fs.readSync(fd, buffer, 0, VectorIndexLength, 256) - fs.close(fd) + fs.close(fd,function(){}) return buffer } @@ -187,7 +187,7 @@ const loadContentFromFile = dbPath => { const buffer = Buffer.alloc(stats.size) const fd = fs.openSync(dbPath, 'r') fs.readSync(fd, buffer, 0, stats.size, 0) - fs.close(fd) + fs.close(fd,function(){}) return buffer }