-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
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
writeFile creates OS inaccessible file #33829
Comments
Could you provide full paths of files you are trying to access? Also, To be clear |
Much appreciated for your help. You are correct, this has nothing to do with node itself, my apologies. As it turns out "AUX" is one of many reserved filenames* on this OS.
Given your last hint I attempted to create a file with the same name "AUX.txt" via the OS itself and it fails with the reserved filename explanation. Somehow node must access a deeper api bypassing the restriction, both for writing and reading. I was caught off guard here. I was generating filenames dynamically for some output and only the AUX.txt file was giving me trouble. I figured the issue had to be deeper than my code, I just did not expect it to be as deep as the OS. Thanks again. This should probably be closed. |
I was not aware of such a requirement on Windows, glad you solved your issue. Perhaps we can handle this better on Windows so ping @nodejs/platform-windows @nodejs/libuv to give your opinion if this is actionable somehow. |
Node uses file namespace paths for file access. We do that so we do not get hit by the 260 path limit, but as a side effect, you can create files with reserved names. Those files are accessible, the app you are using just must support it. You can try opening the file with Anyway, there is nothing for Node to fix here. |
What steps will reproduce the bug?
`var fs = require('fs')
fs.writeFileSync( "AUX.txt", "test", function(err){return console.log(err)} )
console.log( fs.readFileSync( "AUX.txt", {encoding: 'utf-8'}) )`
How often does it reproduce? Is there a required condition?
Always given the provided path "AUX.txt", independently of extension given (tested: "txt" / "js" / null), using another name does not fail.
What is the expected behavior?
A file normally accessible via the OS
What do you see instead?
notepad++:
"\\.\AUX" cannot be opened
"\\." doesn't exist
notepad:
Cannot find the \\.\AUX.txt file
Additional information
The text was updated successfully, but these errors were encountered: