@file-services/utils
Advanced tools
Comparing version 7.0.0 to 7.0.1
@@ -102,13 +102,9 @@ "use strict"; | ||
const { filterFile = returnsTrue, filterDirectory = returnsTrue } = options; | ||
for (const nodeName of readdirSync(rootDirectory)) { | ||
const nodePath = join(rootDirectory, nodeName); | ||
const nodeStats = statSync(nodePath, statsNoThrowOptions); | ||
if (!nodeStats) { | ||
continue; | ||
} | ||
const nodeDesc = { name: nodeName, path: nodePath, stats: nodeStats }; | ||
if (nodeStats.isFile() && filterFile(nodeDesc)) { | ||
for (const item of readdirSync(rootDirectory, { withFileTypes: true })) { | ||
const nodePath = join(rootDirectory, item.name); | ||
const nodeDesc = { name: item.name, path: nodePath }; | ||
if (item.isFile() && filterFile(nodeDesc)) { | ||
filePaths.push(nodePath); | ||
} | ||
else if (nodeStats.isDirectory() && filterDirectory(nodeDesc)) { | ||
else if (item.isDirectory() && filterDirectory(nodeDesc)) { | ||
findFilesSync(nodePath, options, filePaths); | ||
@@ -259,16 +255,10 @@ } | ||
const { filterFile = returnsTrue, filterDirectory = returnsTrue } = options; | ||
for (const nodeName of await readdir(rootDirectory)) { | ||
const nodePath = join(rootDirectory, nodeName); | ||
try { | ||
const nodeStats = await stat(nodePath); | ||
const nodeDesc = { name: nodeName, path: nodePath, stats: nodeStats }; | ||
if (nodeStats.isFile() && filterFile(nodeDesc)) { | ||
filePaths.push(nodePath); | ||
} | ||
else if (nodeStats.isDirectory() && filterDirectory(nodeDesc)) { | ||
await findFiles(nodePath, options, filePaths); | ||
} | ||
for (const item of await readdir(rootDirectory, { withFileTypes: true })) { | ||
const nodePath = join(rootDirectory, item.name); | ||
const nodeDesc = { name: item.name, path: nodePath }; | ||
if (item.isFile() && filterFile(nodeDesc)) { | ||
filePaths.push(nodePath); | ||
} | ||
catch (e) { | ||
/**/ | ||
else if (item.isDirectory() && filterDirectory(nodeDesc)) { | ||
await findFiles(nodePath, options, filePaths); | ||
} | ||
@@ -275,0 +265,0 @@ } |
{ | ||
"name": "@file-services/utils", | ||
"description": "Common file system utility functions.", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"main": "dist/index.js", | ||
"dependencies": { | ||
"@file-services/types": "^7.0.0" | ||
"@file-services/types": "^7.0.1" | ||
}, | ||
@@ -9,0 +9,0 @@ "files": [ |
@@ -115,12 +115,8 @@ import type { | ||
for (const nodeName of readdirSync(rootDirectory)) { | ||
const nodePath = join(rootDirectory, nodeName); | ||
const nodeStats = statSync(nodePath, statsNoThrowOptions); | ||
if (!nodeStats) { | ||
continue; | ||
} | ||
const nodeDesc: IFileSystemDescriptor = { name: nodeName, path: nodePath, stats: nodeStats }; | ||
if (nodeStats.isFile() && filterFile(nodeDesc)) { | ||
for (const item of readdirSync(rootDirectory, { withFileTypes: true })) { | ||
const nodePath = join(rootDirectory, item.name); | ||
const nodeDesc: IFileSystemDescriptor = { name: item.name, path: nodePath }; | ||
if (item.isFile() && filterFile(nodeDesc)) { | ||
filePaths.push(nodePath); | ||
} else if (nodeStats.isDirectory() && filterDirectory(nodeDesc)) { | ||
} else if (item.isDirectory() && filterDirectory(nodeDesc)) { | ||
findFilesSync(nodePath, options, filePaths); | ||
@@ -296,14 +292,9 @@ } | ||
for (const nodeName of await readdir(rootDirectory)) { | ||
const nodePath = join(rootDirectory, nodeName); | ||
try { | ||
const nodeStats = await stat(nodePath); | ||
const nodeDesc: IFileSystemDescriptor = { name: nodeName, path: nodePath, stats: nodeStats }; | ||
if (nodeStats.isFile() && filterFile(nodeDesc)) { | ||
filePaths.push(nodePath); | ||
} else if (nodeStats.isDirectory() && filterDirectory(nodeDesc)) { | ||
await findFiles(nodePath, options, filePaths); | ||
} | ||
} catch (e) { | ||
/**/ | ||
for (const item of await readdir(rootDirectory, { withFileTypes: true })) { | ||
const nodePath = join(rootDirectory, item.name); | ||
const nodeDesc: IFileSystemDescriptor = { name: item.name, path: nodePath }; | ||
if (item.isFile() && filterFile(nodeDesc)) { | ||
filePaths.push(nodePath); | ||
} else if (item.isDirectory() && filterDirectory(nodeDesc)) { | ||
await findFiles(nodePath, options, filePaths); | ||
} | ||
@@ -310,0 +301,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54952
1003
Updated@file-services/types@^7.0.1