Skip to content

Commit

Permalink
FIX: node: async fileCollector support ingetFileList
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-js committed Jan 16, 2024
1 parent 0045f2d commit 55e1319
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions source/node/fs/Directory.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ const withTempDirectorySync = (

const getFileList = async (
path,
fileCollector = DEFAULT_FILE_COLLECTOR // (fileList, { path }) => { fileList.push(path) } // TODO: NOTE: symlink will get skipped, return true will end search, is it needed or cause mostly error?
fileCollector = async (fileList, { path }) => { fileList.push(path) } // TODO: NOTE: symlink will get skipped, return true will end search, is it needed or cause mostly error?
) => {
const fileList = []
const pathStat = await getPathStat(path) // resolve symlink for the initial path
const pathType = getPathTypeFromStat(pathStat)
switch (pathType) {
case PATH_TYPE.File:
fileCollector(fileList, { type: pathType, name: basename(path), path })
await fileCollector(fileList, { type: pathType, name: basename(path), path })
break
case PATH_TYPE.Directory:
await walkDirInfoTree(
Expand All @@ -215,7 +215,7 @@ const getFileList = async (
}
const getFileListSync = (
path,
fileCollector = DEFAULT_FILE_COLLECTOR // (fileList, { path }) => { fileList.push(path) } // TODO: NOTE: symlink will get skipped, return true will end search, is it needed or cause mostly error?
fileCollector = (fileList, { path }) => { fileList.push(path) } // TODO: NOTE: symlink will get skipped, return true will end search, is it needed or cause mostly error?
) => {
const fileList = []
const pathStat = getPathStatSync(path) // resolve symlink for the initial path
Expand All @@ -235,7 +235,6 @@ const getFileListSync = (
}
return fileList
}
const DEFAULT_FILE_COLLECTOR = (fileList, { path }) => { fileList.push(path) }

export {
getPathTypeFromDirent,
Expand Down

0 comments on commit 55e1319

Please sign in to comment.