fromStream.js 517 B

1234567891011121314151617
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.fromStream = void 0;
  4. const concat_1 = require("../buffers/concat");
  5. const fromStream = async (stream) => {
  6. const reader = stream.getReader();
  7. const chunks = [];
  8. while (true) {
  9. const { done, value } = await reader.read();
  10. if (done)
  11. break;
  12. chunks.push(value);
  13. }
  14. return (0, concat_1.listToUint8)(chunks);
  15. };
  16. exports.fromStream = fromStream;
  17. //# sourceMappingURL=fromStream.js.map