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

Function Body

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

Source from the content-addressed store, hash-verified

6083 var INTERNALS = Symbol("Body internals");
6084 var PassThrough = Stream3.PassThrough;
6085 function Body(body) {
6086 var _this = this;
6087 var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size;
6088 let size = _ref$size === void 0 ? 0 : _ref$size;
6089 var _ref$timeout = _ref.timeout;
6090 let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout;
6091 if (body == null) {
6092 body = null;
6093 } else if (isURLSearchParams2(body)) {
6094 body = Buffer.from(body.toString());
6095 } else if (isBlob4(body)) ;
6096 else if (Buffer.isBuffer(body)) ;
6097 else if (Object.prototype.toString.call(body) === "[object ArrayBuffer]") {
6098 body = Buffer.from(body);
6099 } else if (ArrayBuffer.isView(body)) {
6100 body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
6101 } else if (body instanceof Stream3) ;
6102 else {
6103 body = Buffer.from(String(body));
6104 }
6105 this[INTERNALS] = {
6106 body,
6107 disturbed: false,
6108 error: null
6109 };
6110 this.size = size;
6111 this.timeout = timeout;
6112 if (body instanceof Stream3) {
6113 body.on("error", function(err) {
6114 const error = err.name === "AbortError" ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, "system", err);
6115 _this[INTERNALS].error = error;
6116 });
6117 }
6118 }
6119 Body.prototype = {
6120 get body() {
6121 return this[INTERNALS].body;

Callers

nothing calls this directly

Calls 5

isURLSearchParams2Function · 0.85
isBlob4Function · 0.85
fromMethod · 0.45
toStringMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…