Skip to content

Commit

Permalink
fixup! fixup! fs: buffer dir entries in opendir()
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Oct 11, 2019
1 parent 59cf84d commit 751a8b6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions benchmark/fs/bench-opendir.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ async function main({ n, dir, mode }) {
await new Promise((resolve, reject) => {
function read() {
dir.read((err, entry) => {
if (err)
if (err) {
reject(err);
if (entry === null)
} else if (entry === null) {
resolve(dir.close());
else
} else {
counter++;
read();
}
});
}

read();
});
} {
} else {
const dir = fs.opendirSync(fullPath);
while (dir.readSync() !== null)
counter++;
Expand Down

0 comments on commit 751a8b6

Please sign in to comment.