MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / streamToText

Function streamToText

out/cli.cjs:76892–76915  ·  view source on GitHub ↗
(stream4)

Source from the content-addressed store, hash-verified

76890 return unzip;
76891 } else if (contentEncoding === "deflate") {
76892 const inflate = zlib2.createInflate();
76893 stream4.pipe(inflate);
76894 return inflate;
76895 }
76896 return stream4;
76897}
76898function streamToText(stream4) {
76899 return new Promise((resolve, reject) => {
76900 const buffer = [];
76901 stream4.on("data", (chunk) => {
76902 if (Buffer.isBuffer(chunk)) {
76903 buffer.push(chunk);
76904 } else {
76905 buffer.push(Buffer.from(chunk));
76906 }
76907 });
76908 stream4.on("end", () => {
76909 resolve(Buffer.concat(buffer).toString("utf8"));
76910 });
76911 stream4.on("error", (e3) => {
76912 if (e3 && (e3 === null || e3 === void 0 ? void 0 : e3.name) === "AbortError") {
76913 reject(e3);
76914 } else {
76915 reject(new RestError(`Error reading response as text: ${e3.message}`, {
76916 code: RestError.PARSE_ERROR
76917 }));
76918 }

Callers 1

sendRequestMethod · 0.85

Calls 6

rejectFunction · 0.85
concatMethod · 0.80
onMethod · 0.45
pushMethod · 0.45
fromMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…