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

Support any JavaScript environment #85

Merged
merged 1 commit into from
Aug 9, 2023
Merged

Support any JavaScript environment #85

merged 1 commit into from
Aug 9, 2023

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Aug 9, 2023

get-stream does not depend on any Node.js specific imports anymore, with the exception of Buffer.
Buffer is only used with getStreamAsBuffer(). getStreamAsArrayBuffer() can be used instead as an alternative that does not rely on Node.js Buffer.

This PR uses Buffer through globalThis.Buffer instead of import { Buffer } from 'node:buffer' to make it simpler for any JavaScript environment to use get-stream (without any bundler nor shims). It does not remove Buffer support, since this is still useful in a Node.js context.

This makes get-stream now available in any JavaScript environment.

@sindresorhus sindresorhus merged commit d8054a7 into sindresorhus:main Aug 9, 2023
3 checks passed
@ehmicky ehmicky deleted the browsers branch August 9, 2023 22:50
@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.

2 participants