Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

feat(native): add recursive-readdir, fs-readdir-recursive and klaw-sync to replacements - #1229

Open
maksimgm wants to merge 2 commits into
e18e:mainfrom
maksimgm:feat/recursive-readdir
Open

maksimgm wants to merge 2 commits into
e18e:mainfrom
maksimgm:feat/recursive-readdir

Conversation

@maksimgm

@maksimgm maksimgm commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🔗 Linked issue

resolves #655

📚 Description

Adds native replacements for packages that list a directory's files recursively. Node.js has supported this since v18.17.0 / v20.1.0 via fs.readdir(dir, { recursive: true }).

Package Weekly downloads Replacement
recursive-readdir ~6.4M fs.promises.readdir
klaw-sync ~9M fs.readdirSync
fs-readdir-recursive ~5.1M fs.readdirSync
  • manifests/native.json: new fs.promises.readdir and fs.readdirSync replacements, plus the three mappings, all pointing to a shared doc
  • docs/modules/recursive-readdir.md: migration guide for each package, covering recursive-readdir's ignores, fs-readdir-recursive's default dotfile filtering and relative paths, and klaw-sync's { path, stats } items and the nodir/nofile options

Verification: I ran every before/after example in the doc against the real packages (recursive-readdir@2.2.3, fs-readdir-recursive@1.1.0, klaw-sync@8.0.0) on a fixture tree with nested dirs, dotfiles, node_modules and an empty dir. Each pair returned the same set of paths (and the same stats, for klaw-sync). I also checked symlinked folders on node 20, 22 and 24, which is what the symlink note in the doc is based on.

Scope notes:

  • [Replacement]: Several packages can be replaced with fs.readdir(..., { recursie: true }) #655 isn't accepted yet, so this is waiting on that.
  • klaw-sync and fs-readdir-recursive aren't on the issue, but they're the same kind of package (~14M weekly downloads between them). Happy to drop them and keep this to recursive-readdir.
  • Left out recursive-fs (needs fs.rm, fs.cp and fs.readdir), the low-download packages (get-all-files, recur-readdir, recursive-files), and walk-sync (globs, trailing / on dirs and an entries() API, so not a clean swap).
  • readdir order isn't guaranteed to match the packages, so the doc says to sort if you rely on ordering.

@dreyfus92 dreyfus92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this one!

a few things before this can go in:

  • #655 isn't labelled as accepted yet, and klaw-sync / fs-readdir-recursive aren't on the issue, so we need @43081j to accept it and say if he's ok with the wider scope
  • symlinked folders behave differently. recursive-readdir follows them, klaw-sync and fs-readdir-recursive don't, and node isn't consistent either (fs/promises readdir doesn't follow them, readdirSync does on node 22+). worth a short note in the doc
  • the reason line needs the **Motivation:** label and a period at the end
  • please keep the pr template for the description, you can put the verification and scope notes under the description section

@maksimgm

Copy link
Copy Markdown
Contributor Author

my bad, missed that #655 wasn't accepted yet. i'll leave this until it is, and happy to cut it down to just recursive-readdir if the wider scope isn't wanted. i'll add the symlink note, fix the motivation line and move back to the template in the meantime

@maksimgm
maksimgm force-pushed the feat/recursive-readdir branch from 04fb69c to 9cc511d Compare November 20, 2026 06:03
@maksimgm

Copy link
Copy Markdown
Contributor Author

added the symlink note. fwiw fs-readdir-recursive does follow symlinked folders when i tested it, so the doc groups it with recursive-readdir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Replacement]: Several packages can be replaced with fs.readdir(..., { recursie: true })

2 participants