MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / pipeStream

Function pipeStream

packages/ui-default/utils/index.ts:69–86  ·  view source on GitHub ↗
(read, write, abort)

Source from the content-addressed store, hash-verified

67}
68
69export async function pipeStream(read, write, abort) {
70 if (window.WritableStream && read.pipeTo) {
71 const abortController = new AbortController();
72 if (abort) abort.abort = abortController.abort.bind(abortController);
73 await read.pipeTo(write, abortController);
74 } else {
75 const writer = write.getWriter();
76 if (abort) abort.abort = writer.abort.bind(writer);
77 const reader = read.getReader();
78 while (1) {
79 const readResult = await reader.read();
80 if (readResult.done) {
81 writer.close();
82 break;
83 } else writer.write(readResult.value);
84 }
85 }
86}
87
88// https://github.com/andrasq/node-mongoid-js/blob/master/mongoid.js
89export function mongoId(idstring: string) {

Callers 1

downloadFunction · 0.90

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected