1.0.0 • Published 7 years ago

stream-tail v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

stream-tail

Emits the last few chunks of input

Build Status

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