-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
fs.readdir
's new recursive
option is not fully documented
#48640
Comments
can i work on this? |
Can you share the case where it doesn't work with |
Btw it looks more like a bug than a documentation issue. |
No documentation is provided for |
Can I work on this, it will be my first issue. |
@Ethan-Arrowood From further testing, I've found some behavior that varies between the promise, callback, and synchronous versions.
A minor inconsistency I found is that when providing the results the promise version appears to act as depth-first, while the callback and synchronous versions act as breath-first in their resulting arrays. These tests have been on a limited filetree which I've uploaded to |
Okay I can confirm there are two issues here. First, missing documentation for the Second, I am seeing the Finally, I do not believe the difference in search behavior matters. We make no guarantees in how Node recursively searches a directory. In a long historical thread I commented the possibility of specifying which algorithm could be used, but that is a feature not a bug in this case. Some users here expressed interest in contributing, @pernelkanic you commented first. Would you like to work on the documentation fix? |
I believe the promise version has the same lack of documentation, as it and the other versions are lacking a similar description as |
Oh good point 👍 that should be fixed too then |
I'm happy to leave the documentation changes for a new contributor, but can also add those in if we get no response in a couple days. |
@RamdohokarAngha would you be interested in contributing docs for this? |
@Ethan-Arrowood - Yes, I'm interested in contributing docs for this issue. |
Thank you! Go for it! |
Refs: nodejs#48640 PR-URL: nodejs#48698 Fixes: nodejs#48858 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Refs: nodejs#48640 PR-URL: nodejs#48698 Fixes: nodejs#48858 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Refs: nodejs#48640 PR-URL: nodejs#48698 Fixes: nodejs#48858 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: nodejs#48902 Fixes: nodejs#48640 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
- `fs.readdir' func in node version 18.18.2 has buggy `recursive' option See nodejs/node#48640, Effect-TS/effect#1801 for details - We were recursing down a folder in two ways on the Desktop app. Remove `recursive: True' option to the `fs.readdirSync' method call to recurse down via app code only
- `fs.readdir' func in node version 18.18.2 has buggy `recursive' option See nodejs/node#48640, Effect-TS/effect#1801 for details - We were recursing down a folder in two ways on the Desktop app. Remove `recursive: True' option to the `fs.readdirSync' method call to recurse down via app code only
- `fs.readdir' func in node version 18.18.2 has buggy `recursive' option See nodejs/node#48640, Effect-TS/effect#1801 for details - We were recursing down a folder in two ways on the Desktop app. Remove `recursive: True' option to the `fs.readdirSync' method call to recurse down via app code only
PR-URL: nodejs#48902 Fixes: nodejs#48640 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Refs: nodejs/node#48640 PR-URL: nodejs/node#48698 Fixes: nodejs/node#48858 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Refs: nodejs/node#48640 PR-URL: nodejs/node#48698 Fixes: nodejs/node#48858 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Affected URL(s)
https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesreaddirpath-options and callback/synchronous versions
Description of the problem
From testing, therecursive
option does not work withwithFileTypes: true
.The behavior of the
recursive
option is not documented, and onlyrecursive
's type and default value are present in the documentation. The callback-asyncfs.readdir
and the synchronousfs.readdirSync
yield erraneous results (entries missing or appear with missing fields) when bothrecursive
andwithFileTypes
are supplied.This issue tracks missing documentation. Incorrect behavior is tracked at #48858.
The text was updated successfully, but these errors were encountered: