Skip to content
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

Remove encoding option #69

Merged
merged 1 commit into from
Aug 8, 2023
Merged

Remove encoding option #69

merged 1 commit into from
Aug 8, 2023

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Aug 8, 2023

Fixes #67.

This removes the encoding option.

This is a breaking change for users who used the encoding option with getStream() (not with getStreamAsBuffer()) except if they used encoding: undefined, encoding: null or encoding: 'utf8. For users who used encoding: 'hex', please convert to hexadecimal using Buffer.from(string).toString('hex'). For those who used encoding: 'base64', please convert to base64 using either Buffer.from(string).toString('base64') or (for better performance on big streams) with b64.

const chunkTypes = {
buffer: {convertChunk: convertChunkToBuffer, getContents: getContentsAsBuffer},
string: {convertChunk: convertChunkToString, getContents: getContentsAsString},
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This allows adding more types, such as ArrayBuffer, which would be helpful to support ReadableStream.

@sindresorhus sindresorhus merged commit 64cba16 into sindresorhus:main Aug 8, 2023
3 checks passed
@ehmicky ehmicky deleted the remove-encoding branch August 8, 2023 14:48
@ehmicky ehmicky mentioned this pull request Aug 13, 2023
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.

Issues with the encoding option
2 participants