Skip to content
Merged
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
18 changes: 9 additions & 9 deletions lib/internal/fs/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Dir {
);

if (result !== null) {
this.processReadResult(path, result);
this.#processReadResult(path, result);
if (result.length > 0) {
ArrayPrototypePush(this.#handlerQueue, handler);
}
Expand Down Expand Up @@ -125,7 +125,7 @@ class Dir {
const dirent = ArrayPrototypeShift(this.#bufferedEntries);

if (this.#options.recursive && dirent.isDirectory()) {
this.readSyncRecursive(dirent);
this.#readSyncRecursive(dirent);
}

if (maybeSync)
Expand All @@ -151,10 +151,10 @@ class Dir {
}

try {
this.processReadResult(this.#path, result);
this.#processReadResult(this.#path, result);
const dirent = ArrayPrototypeShift(this.#bufferedEntries);
if (this.#options.recursive && dirent.isDirectory()) {
this.readSyncRecursive(dirent);
this.#readSyncRecursive(dirent);
}
callback(null, dirent);
} catch (error) {
Expand All @@ -170,7 +170,7 @@ class Dir {
);
}

processReadResult(path, result) {
#processReadResult(path, result) {
for (let i = 0; i < result.length; i += 2) {
ArrayPrototypePush(
this.#bufferedEntries,
Expand All @@ -183,7 +183,7 @@ class Dir {
}
}

readSyncRecursive(dirent) {
#readSyncRecursive(dirent) {
const path = pathModule.join(dirent.parentPath, dirent.name);
const handle = dirBinding.opendir(
path,
Expand All @@ -209,7 +209,7 @@ class Dir {
if (this.#processHandlerQueue()) {
const dirent = ArrayPrototypeShift(this.#bufferedEntries);
if (this.#options.recursive && dirent.isDirectory()) {
this.readSyncRecursive(dirent);
this.#readSyncRecursive(dirent);
}
return dirent;
}
Expand All @@ -223,11 +223,11 @@ class Dir {
return result;
}

this.processReadResult(this.#path, result);
this.#processReadResult(this.#path, result);

const dirent = ArrayPrototypeShift(this.#bufferedEntries);
if (this.#options.recursive && dirent.isDirectory()) {
this.readSyncRecursive(dirent);
this.#readSyncRecursive(dirent);
}
return dirent;
}
Expand Down
Loading