2.0.1 • Published 1 year ago
hijack-stream v2.0.1
hijack-stream
Temporarily take over a readable stream.
import hijackStream from 'hijack-stream';
const { restore } = hijackStream({
input: process.stdin,
ondata(chunk) { if (chunk.includes('done')) restore(); },
onend(error) { if (error !== null) console.warn(error); }
})Why not use read instead?
Because readdoes not work inside a Node.js REPL.
LICENSE
Apache-2.0