stream-tail
v1.0.0
Published
Through stream that emits the last few chunks of input
Downloads
3
Maintainers
Readme
stream-tail
Emits the last few chunks of input
Example
const
split2 = require("split2"),
join = require("join-stream"),
tail = require("stream-tail");
// Simple implementation of tail(1)
if (process.argv.length !== 3) {
console.error(`Usage: tail NUMBER`);
process.exit(1);
}
process.stdin
.pipe(split2())
.pipe(tail(process.argv[2]))
.pipe(join("\n", { end: true }))
.pipe(process.stdout);
Methods
tail(count)
Return an object stream that emits no more than the final count
'data'
chunks of its input. Where the input contains fewer than count
chunks, all chunks are emitted.
Install
npm install stream-tail
License
MIT