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
Unsorted Filenames #37
Comments
Related with wandersonwhcr/node-config#25 |
Well, in general the file names are not guaranteed to be sorted, as
I added sorting to From nodejs/node#3232 I see that Linux users will expect the files to be sorted. So, I will add a check for Windows: if(!isWin && encoding !== 'buffer') list.sort(); |
But if I want to simulate Windows runtime in my tests, how can I do that? I don't know if |
process.platform = 'win32'; https://github.com/streamich/memfs/blob/master/src/volume.ts#L14 |
Published under version |
Thanks for your attention, but I think it's wrong to modify a global element like |
@wandersonwhcr how would you suggest to do it? |
I'll create a PR soon |
Hello!
First, thank you for your package. I am a Node.js beginner and
memfs
helps me a lot with testing and mocking.I am developing a package to load configuration alphabetically by filenames. Searching for Node.js
fs
readdir
behavior, I just realize this method is always sorted on Linux, but not on Windows (or filesystems, whatever).nodejs/node#3232
https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback
http://man7.org/linux/man-pages/man3/readdir.3.html#NOTES
Thinking about it, currently, I can't simulate a
readdir
with unsorted filenames inmemfs
.https://github.com/streamich/memfs/blob/master/src/volume.ts#L1486
Can we improve some configuration to disable that feature, or implement another sort?
The text was updated successfully, but these errors were encountered: