MCPcopy Create free account
hub / github.com/angular/dev-infra / consume

Function consume

github-actions/saucelabs/set-saucelabs-env.js:9798–9836  ·  view source on GitHub ↗
(stream, type)

Source from the content-addressed store, hash-verified

9796 return this[kBody];
9797 }
9798 dump(opts) {
9799 return __async(this, null, function* () {
9800 let limit = Number.isFinite(opts == null ? void 0 : opts.limit) ? opts.limit : 128 * 1024;
9801 const signal = opts == null ? void 0 : opts.signal;
9802 if (signal != null && (typeof signal !== "object" || !("aborted" in signal))) {
9803 throw new InvalidArgumentError("signal must be an AbortSignal");
9804 }
9805 signal == null ? void 0 : signal.throwIfAborted();
9806 if (this._readableState.closeEmitted) {
9807 return null;
9808 }
9809 return yield new Promise((resolve2, reject) => {
9810 if (this[kContentLength] > limit) {
9811 this.destroy(new AbortError());
9812 }
9813 const onAbort = () => {
9814 var _a;
9815 this.destroy((_a = signal.reason) != null ? _a : new AbortError());
9816 };
9817 signal == null ? void 0 : signal.addEventListener("abort", onAbort);
9818 this.on("close", function() {
9819 var _a;
9820 signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
9821 if (signal == null ? void 0 : signal.aborted) {
9822 reject((_a = signal.reason) != null ? _a : new AbortError());
9823 } else {
9824 resolve2(null);
9825 }
9826 }).on("error", noop).on("data", function(chunk) {
9827 limit -= chunk.length;
9828 if (limit <= 0) {
9829 this.destroy();
9830 }
9831 }).resume();
9832 });
9833 });
9834 }
9835 };
9836 function isLocked(self) {
9837 return self[kBody] && self[kBody].locked === true || self[kConsume];
9838 }
9839 function isUnusable(self) {

Callers 5

textMethod · 0.70
jsonMethod · 0.70
blobMethod · 0.70
bytesMethod · 0.70
arrayBufferMethod · 0.70

Calls 5

__asyncFunction · 0.70
isUnusableFunction · 0.70
consumeFinishFunction · 0.70
consumeStartFunction · 0.70
onMethod · 0.45

Tested by

no test coverage detected