GeezerVison is showing github.com — fs.writeFile callback has no error when writing file failed · Issue #13868 · nodejs/node
fs.writeFile callback has no error when writing file failed #13868Labels fsIssues and PRs related to file-system APIs and the fs module.libuvIssues and PRs related to the libuv dependency or the uv binding.windowsIssues and PRs related to the Windows platform.wipIssues and PRs that are still a work in progress. Description
- Version: v8.1.2
- Platform: win10 64bit
var fs = require('fs');
fs.writeFile('test: abc.js', 'aaaa', function (err) {
debugger;
});
The filename has a colon which is not allowed on win10.
The piece of code wrote a file named test which suppose to be test: abc.js, and there was no content.
The execution was failed, but there was no error. Parameter err is null. Reacted by Refael Ackermann, cheerfunfun and Parvez Kose Activityadded windowsIssues and PRs related to the Windows platform. fsIssues and PRs related to file-system APIs and the fs module. libuvIssues and PRs related to the libuv dependency or the uv binding. on Jun 22, 2017XadillaX commented on Jun 22, 2017 XadillaX commented on Jun 22, 2017 It seems CreateFileW (Refer here) don't support :. I'll try to work for it. bzoz commented on Jun 27, 2017 This is a lesser known feature of Windows - alternative data streams. You can read more about them in this MSDN article.
The data is there:
D:\>node -e "require('fs').writeFile('testfile:abc', 'some data', console.log)"
null
D:\>dir /r testfile
Volume in drive D is Staff
Volume Serial Number is 565B-E08C
Directory of D:\
27.06.2017 10:49 0 testfile
9 testfile:abc:$DATA
1 File(s) 0 bytes
0 Dir(s) 10 776 190 976 bytes free
D:\>more < testfile
D:\>more < testfile:abc
some data
bzoz commented on Jun 27, 2017 Also, note that for other chars Node fails as expected:
D:\>node -e "require('fs').writeFile('testfile>abc', 'some data', console.log)"
{ Error: ENOENT: no such file or directory, open 'D:\testfile>abc'
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'D:\\testfile>abc' }
apoliszk commented on Jun 28, 2017 Thanks everyone.
I got it.
It is how windows is designed, not a bug. bhadkiaftab commented on Aug 10, 2017 This error will occure when mentioned directory is not present in that path.
MetadataMetadatafsIssues and PRs related to file-system APIs and the fs module.libuvIssues and PRs related to the libuv dependency or the uv binding.windowsIssues and PRs related to the Windows platform.wipIssues and PRs that are still a work in progress. DevelopmentNo branches or pull requestsIssue actions
|