MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / pipeTo

Method pipeTo

examples/io/streams/modules/streams.js:308–325  ·  view source on GitHub ↗
(destination, options)

Source from the content-addressed store, hash-verified

306 return transform.readable;
307 }
308 pipeTo(destination, options) {
309 try {
310 const readableStream = ReadableStreamBrand.get(this);
311 const writableStream = WritableStreamBrand.get(destination, "destination");
312 const preventAbort = Boolean(options?.preventAbort);
313 const preventCancel = Boolean(options?.preventCancel);
314 const preventClose = Boolean(options?.preventClose);
315 const signal = options?.signal;
316 if (IsReadableStreamLocked(readableStream))
317 throw new TypeError("stream locked");
318 if (IsWritableStreamLocked(writableStream))
319 throw new TypeError("destination stream locked");
320 return ReadableStreamPipeTo(readableStream, writableStream, preventClose, preventAbort, preventCancel, signal);
321 }
322 catch(error) {
323 return Promise.reject(error);
324 }
325 }
326 tee() {
327 const stream = ReadableStreamBrand.get(this);
328 const result = ReadableStreamTee(stream, false);

Callers 1

main.jsFile · 0.45

Calls 4

IsReadableStreamLockedFunction · 0.85
IsWritableStreamLockedFunction · 0.85
ReadableStreamPipeToFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected