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

Function consume

out/cli.cjs:56186–56209  ·  view source on GitHub ↗
(stream4, type2)

Source from the content-addressed store, hash-verified

56184 }
56185 };
56186 function isLocked(self2) {
56187 return self2[kBody] && self2[kBody].locked === true || self2[kConsume];
56188 }
56189 function isUnusable(self2) {
56190 return util4.isDisturbed(self2) || isLocked(self2);
56191 }
56192 async function consume(stream4, type2) {
56193 if (isUnusable(stream4)) {
56194 throw new TypeError("unusable");
56195 }
56196 assert2(!stream4[kConsume]);
56197 return new Promise((resolve, reject) => {
56198 stream4[kConsume] = {
56199 type: type2,
56200 stream: stream4,
56201 resolve,
56202 reject,
56203 length: 0,
56204 body: []
56205 };
56206 stream4.on("error", function(err) {
56207 consumeFinish(this[kConsume], err);
56208 }).on("close", function() {
56209 if (this[kConsume].body !== null) {
56210 consumeFinish(this[kConsume], new RequestAbortedError());
56211 }
56212 });

Callers 4

textMethod · 0.85
jsonMethod · 0.85
blobMethod · 0.85
arrayBufferMethod · 0.85

Calls 3

isUnusableFunction · 0.85
consumeFinishFunction · 0.85
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…