We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using memfs:
memfs
const { fs } = require('memfs'); fs.writeFileSync('/foo', 'hello'); console.log(fs.readFileSync('/foo/', 'utf8')); // logs 'hello'
Using the builtin fs (on Linux):
fs
const fs = require('node:fs'); fs.writeFileSync('/foo', 'hello'); console.log(fs.readFileSync('/foo/', 'utf8')); // throws ENOTDIR
Using the builtin fs (on Windows):
const fs = require('node:fs'); fs.writeFileSync('C:/foo', 'hello'); console.log(fs.readFileSync('C:/foo/', 'utf8')); // logs 'hello'
I think a trailing slash means the path is intended to point at a folder, so trying to read from it should throw.
Not sure why Windows is weird, maybe the behavior should differ based on isWin.
isWin
Tested with memfs v4.11.1 and Node.js v20.12.2
The text was updated successfully, but these errors were encountered:
Have you tried your Windows test with \\ instead of /?
\\
/
Sorry, something went wrong.
Yes, it still reads the file successfully
hmm interesting - that might be a bug in Node
No branches or pull requests
Using
memfs
:Using the builtin
fs
(on Linux):Using the builtin
fs
(on Windows):I think a trailing slash means the path is intended to point at a folder, so trying to read from it should throw.
Not sure why Windows is weird, maybe the behavior should differ based on
isWin
.Tested with memfs v4.11.1 and Node.js v20.12.2
The text was updated successfully, but these errors were encountered: