@jsenv/filesystem
Advanced tools
Comparing version 2.7.0 to 2.7.1
{ | ||
"name": "@jsenv/filesystem", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "Collection of functions to interact with filesystem in Node.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -22,8 +22,16 @@ import { readdirSync, realpathSync } from "node:fs" | ||
i++ | ||
const namesOnFileSystem = readdirSync( | ||
// When Node.js receives "C:/" on windows it returns | ||
// the process.cwd() directory content... | ||
// This can be fixed by passing "file:///C:/" directly but as a url object | ||
new URL(reconstructedFileUrl), | ||
) | ||
let namesOnFileSystem | ||
try { | ||
namesOnFileSystem = readdirSync( | ||
// When Node.js receives "C:/" on windows it returns | ||
// the process.cwd() directory content... | ||
// This can be fixed by passing "file:///C:/" directly but as a url object | ||
new URL(reconstructedFileUrl), | ||
) | ||
} catch (e) { | ||
if (e && e.code === "ENOENT") { | ||
return null | ||
} | ||
throw e | ||
} | ||
const foundOnFilesystem = namesOnFileSystem.includes(name) | ||
@@ -36,2 +44,5 @@ if (foundOnFilesystem) { | ||
) | ||
if (!nameOnFileSystem) { | ||
return null | ||
} | ||
reconstructedFileUrl += nameOnFileSystem | ||
@@ -38,0 +49,0 @@ } |
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
99581
2755