MCPcopy
hub / github.com/di-sukharev/opencommit / cloneBody

Function cloneBody

out/cli.cjs:52255–52265  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

52253 ReadableStream7 = require("stream/web").ReadableStream;
52254 }
52255 if (object instanceof ReadableStream7) {
52256 assert2(!util4.isDisturbed(object), "The body has already been consumed.");
52257 assert2(!object.locked, "The stream is locked.");
52258 }
52259 return extractBody(object, keepalive);
52260 }
52261 function cloneBody(body) {
52262 const [out1, out2] = body.stream.tee();
52263 const out2Clone = structuredClone2(out2, { transfer: [out2] });
52264 const [, finalClone] = out2Clone.tee();
52265 body.stream = out1;
52266 return {
52267 stream: finalClone,
52268 length: body.length,

Callers 2

cloneResponseFunction · 0.85
cloneRequestFunction · 0.85

Calls 1

teeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…