Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions lib/internal/fs/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,22 @@ class Dir {
pathModule.toNamespacedPath(dirent.path),
this[kDirOptions].encoding,
undefined,
ctx,
ctx
);
handleErrorFromBinding(ctx);
const result = handle.read(
this[kDirOptions].encoding,
this[kDirOptions].bufferSize,
undefined,
ctx,
);
while (true) {
const result = handle.read(
this[kDirOptions].encoding,
this[kDirOptions].bufferSize,
undefined,
ctx,
);

if (result) {
this.processReadResult(dirent.path, result);
if (result) {
this.processReadResult(dirent.path, result);
} else {
break;
}
}

handle.close(undefined, ctx);
Expand Down Expand Up @@ -206,7 +210,7 @@ class Dir {
this[kDirOptions].encoding,
this[kDirOptions].bufferSize,
undefined,
ctx,
ctx
);
handleErrorFromBinding(ctx);

Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-fs-opendir-recursive.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function processDirSync(dir) {
// Opendir read results sync

{
const dir = fs.opendirSync(testDir, { recursive: true });
const dir = fs.opendirSync(testDir, { recursive: true, bufferSize: 1 });
processDirSync(dir);
dir.closeSync();
}
Expand Down