abi
abi14mo ago

Remove sink from stream

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.
}
},
}),
);
1 Reply
abi
abi14mo ago
i worked around it using readerFromStreamReader and abortable