D
Deno

help

Remove sink from stream

Aabi5/21/2023
Is it at all possible to "undo" adding a sink on a stream? I am trying to make it so that once the writable stream fulfills some condition, it should stop reading from the readable.
someProcess.stderr.pipeTo(
new WritableStream({
write(chunk, controller) {
if (someCondition()) {
// how the heck do i "undo" this sink?
// i want to stop processing here, and i don't care what
// happens to stderr after this point.
}
},
}),
);
someProcess.stderr.pipeTo(
new WritableStream({
write(chunk, controller) {
if (someCondition()) {
// how the heck do i "undo" this sink?
// i want to stop processing here, and i don't care what
// happens to stderr after this point.
}
},
}),
);
i worked around it using readerFromStreamReader and abortable

Looking for more? Join the community!