fix(encoding): Fix malfunctioning encoding option #7
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.
Overview
This pull request addresses an issue with the
encoding
option in thels
function, where it was previously malfunctioning and limited to certain encodings such as'utf8'
,'binary'
, and'ascii'
. The issue caused errors when using other encodings such as'hex'
. The problem has been resolved, and theencoding
option now works as expected, allowing for more flexibility and robustness in encoding file paths.Details
APIs Enhancements
encoding
option in thels
function, which previously only supported a limited set of encodings.'base64'
, leading to invalid path errors.encoding
option and implementing theencodeTo
internal function to handle encoding and decoding of file paths.encoding
option now supports a wider range of encodings and works as expected, providing users with more flexibility in encoding file paths.Let's assume you have a tree directory like this:
And you have this code inside the
foo.js
file to list the directory with'base64'
encoding:Before this change, you might see an error like this:
But, after this change now you can see the expected result:
Test Environments
encoding
option in various scenarios, ensuring its functionality and reliability.Summary
This pull request resolves an issue with the
encoding
option in thels
function, improving its functionality and reliability. With these changes, users can now specify a wider range of encodings, allowing for more flexibility in handling file paths.