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

Function ReadableStreamFrom

github-actions/saucelabs/set-saucelabs-env.js:1473–1508  ·  view source on GitHub ↗
(iterable)

Source from the content-addressed store, hash-verified

1471 };
1472 }
1473 function ReadableStreamFrom(iterable) {
1474 let iterator;
1475 return new ReadableStream(
1476 {
1477 start() {
1478 return __async(this, null, function* () {
1479 iterator = iterable[Symbol.asyncIterator]();
1480 });
1481 },
1482 pull(controller) {
1483 return __async(this, null, function* () {
1484 const { done, value } = yield iterator.next();
1485 if (done) {
1486 queueMicrotask(() => {
1487 var _a2;
1488 controller.close();
1489 (_a2 = controller.byobRequest) == null ? void 0 : _a2.respond(0);
1490 });
1491 } else {
1492 const buf = Buffer.isBuffer(value) ? value : Buffer.from(value);
1493 if (buf.byteLength) {
1494 controller.enqueue(new Uint8Array(buf));
1495 }
1496 }
1497 return controller.desiredSize > 0;
1498 });
1499 },
1500 cancel(reason) {
1501 return __async(this, null, function* () {
1502 yield iterator.return();
1503 });
1504 },
1505 type: "bytes"
1506 }
1507 );
1508 }
1509 function isFormDataLike(object) {
1510 return object && typeof object === "object" && typeof object.append === "function" && typeof object.delete === "function" && typeof object.get === "function" && typeof object.getAll === "function" && typeof object.has === "function" && typeof object.set === "function" && object[Symbol.toStringTag] === "FormData";
1511 }

Callers 2

extractBodyFunction · 0.70
bodyMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected