Closed billiegoose closed 6 years ago
Ah, that is an interesting edge case. I'd accept a pull request for a fix.
I've got too much on my plate right now. But I find googling errors and finding the Github issue(s) people have made and the resulting discussions extremely useful, even if the issues are never closed. :)
@wmhilton this is not a bug, and is FS dependent. For example, on my Mac, the following happens in Node v9.3.0:
> fs.statSync('README.md/fakefile')
Error: ENOTDIR: not a directory, stat 'README.md/fakefile'
at Object.fs.statSync (fs.js:968:11)
Thus, I am closing this as invalid.
I can replicate that result. I get 'ENOTDIR' on a Mac and 'ENOENT' on Windows. So apparently what error to return is not well defined behavior.
Too bad file systems don't use HTTP statuses; then it would just be '404 Not Found'.
Edge case, maybe not worth fixing but worth posting on the Internet in case it helps someone.
On Node, if I have a file, say "README.txt" and do
fs.stat('README.txt/.git')
I will getENOENT
. However, because README.txt is an actual file, if you dofs.stat('README.txt/.git')
in BrowserFS you end up getting a different error, 'ENOTDIR', directly fromIndexedDBFileSystem.getDirListing
.