aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/node_streams_consumer.exports.js
blob: 83d447a4335b7cc4be56e9aa328ab6a56e83caa2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
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;