npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

whole-line-stream

v0.1.2

Published

Pass whole lines to subsequent stream, possibly prefixed

Readme

whole-line-stream

The main aim of this module is for passing output from subprocess to standard output (or standard error) of the parent process. If there are multiple such subprocesses, then they may be writing chunks to their output which don't constitute whole lines. If such chunks from different children get interleaved, the resulting mix may be unintelegible. To avoid this problem, the implementation at hand ensures that it is reading a whole line from its input before passing that on to its output. To distinguish the children even better, each line passing through an instance of this stream may be prefixed by some fixed string.

Example

var WholeLineStream = require("whole-line-stream");
var spawn = require("child_process").spawn;

// Run two process to list files. Not particularly useful, but short.
var find = spawn("find", [".", "-type", "f"]);
find.stdout.pipe(new WholeLineStream("[find] ")).pipe(process.stdout);
find.stderr.pipe(new WholeLineStream("[find] ")).pipe(process.stderr);
var git = spawn("git", ["ls-files"]);
git.stdout.pipe(new WholeLineStream("[git]   ")).pipe(process.stdout);
git.stderr.pipe(new WholeLineStream("[git]   ")).pipe(process.stderr);

Carriage returns

The carriage return character \r is interpreted as moving the cursor back to the beginning of the current line. Subsequent output will overwrite the initial portion of the line. This is used e.g. by some Mocha reporters. The output of this stream will never contain \r. This also means that Windows-style \r\n will get turned into plain \n.

API

new WholeLineStream([prefix])

Constructs a new WholeLineStream. The optional prefix argument will be converted to a buffer, which will be written to the output prior to each whole line of input.

License

This package is licensed unter the MIT license.

See also

The split module does split its input into lines as well, but it operates on strings not buffers, and it doesn't support prefixing lines.