// dont use deno repl for this code, use deno eval instead, b/c the Deno.stdin access will freeze the whole repl
const [ stream1, newStdinReadable ] = Deno.stdin.readable.tee()
const stream2 = new WritableStream({}, new CountQueuingStrategy({ highWaterMark: 1 }))
stream1.pipeTo(
stream2,
{ preventClose: false, preventAbort: false, preventCancel: false,}
)
// stream1.stopPipingTo(stream2)
try { await stream1.cancel() } catch (error) { console.log(error) }
// ^ Cannot cancel a locked ReadableStream.
try { await stream1.abort() } catch (error) { console.log(error) }
// ^ TypeError: stream1.abort is not a function
try { await stream1.close() } catch (error) { console.log(error) }
// ^ TypeError: stream1.close is not a function
try { await stream2.cancel() } catch (error) { console.log(error) }
// ^ TypeError: stream2.cancel is not a function
try { await stream2.abort() } catch (error) { console.log(error) }
// ^ TypeError: The writable stream is locked, therefore cannot be aborted.
try { await stream2.close() } catch (error) { console.log(error) }
// ^ TypeError: The writable stream is locked, therefore cannot be closed.
// dont use deno repl for this code, use deno eval instead, b/c the Deno.stdin access will freeze the whole repl
const [ stream1, newStdinReadable ] = Deno.stdin.readable.tee()
const stream2 = new WritableStream({}, new CountQueuingStrategy({ highWaterMark: 1 }))
stream1.pipeTo(
stream2,
{ preventClose: false, preventAbort: false, preventCancel: false,}
)
// stream1.stopPipingTo(stream2)
try { await stream1.cancel() } catch (error) { console.log(error) }
// ^ Cannot cancel a locked ReadableStream.
try { await stream1.abort() } catch (error) { console.log(error) }
// ^ TypeError: stream1.abort is not a function
try { await stream1.close() } catch (error) { console.log(error) }
// ^ TypeError: stream1.close is not a function
try { await stream2.cancel() } catch (error) { console.log(error) }
// ^ TypeError: stream2.cancel is not a function
try { await stream2.abort() } catch (error) { console.log(error) }
// ^ TypeError: The writable stream is locked, therefore cannot be aborted.
try { await stream2.close() } catch (error) { console.log(error) }
// ^ TypeError: The writable stream is locked, therefore cannot be closed.