hijack-stream
Temporarily take over a readable stream
Last updated 5 years ago by addaleax .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install hijack-stream 
SYNC missed versions from official npm registry.

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

MIT

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago

Copyright 2013 - present © cnpmjs.org | Home |