diff options
Diffstat (limited to 'src/js/node/stream.consumers.js')
-rw-r--r-- | src/js/node/stream.consumers.js | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/js/node/stream.consumers.js b/src/js/node/stream.consumers.js index 8dbe2920a..4df51d1bf 100644 --- a/src/js/node/stream.consumers.js +++ b/src/js/node/stream.consumers.js @@ -1,18 +1,15 @@ // Hardcoded module "node:stream/consumers" / "readable-stream/consumer" -const { Bun } = $lazy("primordials"); +const arrayBuffer = Bun.readableStreamToArrayBuffer; +const text = Bun.readableStreamToText; +const json = stream => Bun.readableStreamToText(stream).then(JSON.parse); -export const arrayBuffer = Bun.readableStreamToArrayBuffer; -export const text = Bun.readableStreamToText; -export const json = stream => Bun.readableStreamToText(stream).then(JSON.parse); - -export const buffer = async readableStream => { +const buffer = async readableStream => { return new Buffer(await arrayBuffer(readableStream)); }; -export const blob = Bun.readableStreamToBlob; +const blob = Bun.readableStreamToBlob; export default { - [Symbol.for("CommonJS")]: 0, arrayBuffer, text, json, |