Dev Helpers
← Back

Clone a response before reading

Clone a response before reading using Node.js.

Open this example in the interactive library

Source code

import { Blob } from "node:buffer";
console.log(
  await (async () => {
    const r = new Response("twice");
    return Promise.all([r.clone().text(), r.text()]);
  })(),
);

Sample output

[ 'twice', 'twice' ]