fix(ext/node): implement url.fileURLToPathBuffer#34883
Merged
Merged
Conversation
Adds the `fileURLToPathBuffer` export to node:url. Like fileURLToPath, but returns the path as a Buffer of raw bytes obtained by percent-decoding the URL without interpreting the result as UTF-8, allowing recovery of paths that contain non-Unicode byte sequences. Implements the WHATWG percent-decode algorithm (percentDecode) operating on raw bytes, plus posix/win32 path extraction mirroring Node's getPathBufferFromURLPosix / getPathBufferFromURLWin32. Enables parallel/test-fileurltopathbuffer.js in the node_compat suite.
Contributor
Author
|
@crowlKats ready for review |
crowlKats
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
fileURLToPathBufferexport tonode:url.Like
fileURLToPath, but returns the path as aBufferof raw bytes obtained by percent-decoding the URL without interpreting the result as UTF-8. This allows recovering file paths that contain non-Unicode byte sequences (e.g. Shift-JIS file names) thatfileURLToPathcannot decode.Implements the WHATWG percent-decode algorithm operating on raw bytes, plus posix/win32 path extraction mirroring Node's
getPathBufferFromURLPosix/getPathBufferFromURLWin32.Enables
parallel/test-fileurltopathbuffer.jsin the node_compat suite, which round-trips a non-Unicode path:The target test passes locally (the upstream test skips on macOS and Windows). Adjacent
node:url/ fileurl tests are unaffected.