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

Function consumeEnd

out/cli.cjs:56229–56254  ·  view source on GitHub ↗
(consume2)

Source from the content-addressed store, hash-verified

56227 consume2.stream.on("end", function() {
56228 consumeEnd(this[kConsume]);
56229 });
56230 }
56231 consume2.stream.resume();
56232 while (consume2.stream.read() != null) {
56233 }
56234 }
56235 function consumeEnd(consume2) {
56236 const { type: type2, body, resolve, stream: stream4, length } = consume2;
56237 try {
56238 if (type2 === "text") {
56239 resolve(toUSVString(Buffer.concat(body)));
56240 } else if (type2 === "json") {
56241 resolve(JSON.parse(Buffer.concat(body)));
56242 } else if (type2 === "arrayBuffer") {
56243 const dst = new Uint8Array(length);
56244 let pos = 0;
56245 for (const buf of body) {
56246 dst.set(buf, pos);
56247 pos += buf.byteLength;
56248 }
56249 resolve(dst.buffer);
56250 } else if (type2 === "blob") {
56251 if (!Blob5) {
56252 Blob5 = require("buffer").Blob;
56253 }
56254 resolve(new Blob5(body, { type: stream4[kContentType] }));
56255 }
56256 consumeFinish(consume2);
56257 } catch (err) {

Callers 1

consumeStartFunction · 0.85

Calls 6

toUSVStringFunction · 0.85
consumeFinishFunction · 0.85
concatMethod · 0.80
parseMethod · 0.45
setMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…