sindresorhus / get-stream

Get a stream as a string, Buffer, ArrayBuffer or array
MIT License
341 stars 33 forks source link

Support any JavaScript environment #85

Closed ehmicky closed 1 year ago

ehmicky commented 1 year ago

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.