|
|
|
|
|
by Rapzid
2338 days ago
|
|
Go's stdlib mistakenly sorted files by default on directory walks(with no option to not sort them). This of course means a directory must be fully iterated on before you can process or bail out of processing. I wonder if Deno ported this directly or reworked it. There are some other issues with file stats as well; requiring multiple syscalls to retrieve information that can be had in just one. It's a mystery to me why they made such a high level decision in such low level code without an escape hatch.. Been a lot of talk but probably won't be fixed any time soon due to backwards compatibility. |
|
Just implement your own directory walk based on `readdir` or whatever fs operations you need directly.
Or use a library that has already done this: https://github.com/karrick/godirwalk#configurable-sorting-of...
The high level interface made one choice. The escape hatch is to use a lower level interface.