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

piperline

v1.0.0

Published

Simple task pipeline runner.

Readme

piperline

Split your async code into small tasks.

Simple task pipeline runner which allows you to split you async code into small tasks.

npm version Actions Status

Installation

npm


$ npm install --save piperline

Features

  • async tasks
  • re-usage
  • interruption
  • extensibility
  • event-based control

Usage

Basic


var Piperline = require('piperline');

Piperline.create()
    .pipe(function(data, next, done) {
        next('foo');
    })
    .pipe(function(data, next, done) {
        next(data + ' bar');
    })
    .on('error', function(err) {
        console.error(err);
    })
    .on('done', function(result) {
        console.log(result); // foo bar
    })
    .run();

Passing initial data


var Piperline = require('piperline');

Piperline.create()
    .pipe(function(data, next, done) {
        next(data + 1);
    })
    .pipe(function(data, next, done) {
        next(data + 2);
    })
    .on('error', function(err) {
        console.error(err);
    })
    .on('done', function(result) {
        console.log(result); // 4
    })
    .run(1);

Passing callback


var pipeline = require('piperline').create();

pipeline
    .pipe(function(data, next, done) {
        next(data + 1);
    })
    .pipe(function(data, next, done) {
        next(data + 2);
    })
    .on('error', function(err) {
        console.error(err);
    })
    .on('done', function(result) {
        console.log(result); // 3
    })
    .run(0, function(err, data) {
        if (err) {
            // do stuff
        }
    });

Pipeline interruption


var Piperline = require('piperline');

Piperline.create()
    .pipe(function(data, next, done) {
        next(data + 1);
    })
    .pipe(function(data, next, done) {
        if (data === 1) {
            done(data);
        }

        next(data + 2);
    })
    .pipe(function(data, next, done) {
        next(data + 3);
    })
    .on('error', function(err) {
        console.error(err);
    })
    .on('done', function(result) {
        console.log(result); // 1
    })
    .run(0);

Re-usage


var pipeline = require('piperline').create();

pipeline
    .pipe(function(data, next, done) {
        // do stuff
        next();
    })
    .pipe(function(data, next, done) {
        // do stuff
        next();
    })
    .on('finish', () => {
        // everything is completed
    });

[1, 2, 3, 4].forEach(data => pipeline.run(data));

Manual error emitting

Emitting error via callback (done or next) by passing Error object.


var pipeline = require('piperline').create();

pipeline
    .pipe(function(data, next) {
        next(data);
    })
    .pipe(function(data, next, done) {
        done(new Error());
    })
    .on('error', function(err) {
      console.log(err); // Error
    })
    .run(0);

API

piperline.create()

Creates a new pipeline runner.

.pipe(function(data, next, done))

Adds pipe for execution. Can be invoked only before or after execution.

data - any data passed from top pipes or run method.

next - callback which invokes next pipe or completes the execution. Any passed data to this callback will be transferred to the next pipe.

done - callback which terminates the execution of the whole pipeline.

Note: If Error object will be passed to one of these callbacks it will be treated as termination of execution and error event will be emitted with this object.

.run([data],[function(error, result)])

Builds and runs the execution.

data - any initial data which will be passed to the first pipe.

callback - callback which will be called when the execution is completed.

.isRunning()

Detects whether the pipeline is executing.

.on('run', function())

Fired every time when execution started and there are no already running in background.

.on('finish', function())

Fired every time when execution completed and there are no already running in background.

.on('done', function(result))

Fired for each successful execution.

.on('error', function(error))

Fired for each failed execution.