Skip to content

fs: honor encoding option in glob APIs#62068

Open
jorgitin02 wants to merge 1 commit intonodejs:mainfrom
jorgitin02:fix/59202-glob-buffer-encoding
Open

fs: honor encoding option in glob APIs#62068
jorgitin02 wants to merge 1 commit intonodejs:mainfrom
jorgitin02:fix/59202-glob-buffer-encoding

Conversation

@jorgitin02
Copy link

@jorgitin02 jorgitin02 commented Mar 2, 2026

Summary

  • honor encoding for fs.globSync(), fs.glob(), and fsPromises.glob() so encoding: 'buffer' returns Buffer paths and Buffer dirent names with withFileTypes
  • avoid mutating cached dirents by cloning at output conversion boundaries
  • add regression coverage for buffer parity, invalid encoding, absolute-pattern behavior, and document the option/return types (including async iterator buffer output)

Testing

  • python3 tools/test.py test/parallel/test-fs-glob.mjs test/parallel/test-fs-glob-throw.mjs test/parallel/test-fs-readdir-buffer.js test/parallel/test-fs-readdir-types.js

#59202.

Align glob, globSync, and fsPromises.glob with encoding semantics so encoding: 'buffer' returns Buffer paths and Buffer dirent names. Add regression tests and docs updates to lock behavior.
@jorgitin02
Copy link
Author

Compact update: this addresses the #59202 review blockers (no cached-dirent mutation, YAML metadata added, invalid-encoding + absolute-pattern tests).

@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants