Merge pull request #263 from sir051223/master

add default callback for fs.close to compitable with the higher version
This commit is contained in:
狮子的魂 2022-10-13 22:06:21 +08:00 committed by GitHub
commit 3316fce5f5
1 changed files with 3 additions and 3 deletions

View File

@ -122,7 +122,7 @@ class Searcher {
} }
} }
if (fd) { if (fd) {
fs.close(fd) fs.close(fd,function(){})
} }
const diff = process.hrtime(startTime) const diff = process.hrtime(startTime)
@ -178,7 +178,7 @@ const loadVectorIndexFromFile = dbPath => {
const fd = fs.openSync(dbPath, 'r') const fd = fs.openSync(dbPath, 'r')
const buffer = Buffer.alloc(VectorIndexLength) const buffer = Buffer.alloc(VectorIndexLength)
fs.readSync(fd, buffer, 0, VectorIndexLength, 256) fs.readSync(fd, buffer, 0, VectorIndexLength, 256)
fs.close(fd) fs.close(fd,function(){})
return buffer return buffer
} }
@ -187,7 +187,7 @@ const loadContentFromFile = dbPath => {
const buffer = Buffer.alloc(stats.size) const buffer = Buffer.alloc(stats.size)
const fd = fs.openSync(dbPath, 'r') const fd = fs.openSync(dbPath, 'r')
fs.readSync(fd, buffer, 0, stats.size, 0) fs.readSync(fd, buffer, 0, stats.size, 0)
fs.close(fd) fs.close(fd,function(){})
return buffer return buffer
} }