blob: 39d436eed5561d2300a9ce0083d5293974e84d02 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// Hardcoded module "node:stream/consumers" / "readable-stream/consumer"
const { Bun } = import.meta.primordials;
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 => {
return new Buffer(await arrayBuffer(readableStream));
};
export const blob = Bun.readableStreamToBlob;
export default {
[Symbol.for("CommonJS")]: 0,
arrayBuffer,
text,
json,
buffer,
blob,
};
|