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 🙏

© 2024 – Pkg Stats / Ryan Hefner

pipeline-manifold

v2.0.0

Published

Pipe one stdout to many stdin

Downloads

12

Readme

pipeline-manifold

This is a utility for directing a flow of data to many destinations.

As a simple example, let's assume we have some need to tail /var/log/system.log and write it to /tmp/out.1 and /tmp/out.2. We can do that by:

$ tail -n 0 -F /var/log/system.log | pipeline-manifold -c /tmp/example.json

Where example.json is:

{
  "pipes": [
    { "bin": "/usr/bin/tee", "args": ["/tmp/out.1"] },
    { "bin": "/usr/bin/tee", "args": ["/tmp/out.2"] }
  ]
}

We could also do it completely with pipeline-manifold:

$ pipeline-manifold -c /tmp/example.json

Where example.json is:

{
  "input": {
    "bin": "/usr/bin/tail",
    "args": ["-n", "0", "-F", "/var/log/system.log"]
  },
  "pipes": [
    { "bin": "/usr/bin/tee", "args": ["/tmp/out.1"] },
    { "bin": "/usr/bin/tee", "args": ["/tmp/out.2"] }
  ]
}

Install

pipeline-manifold should be installed globably as it is only useful as a utility:

$ npm install -g --production pipeline-manifold

Configuration

pipeline-manifold requires a configuration file that at least defines a set of outputs. It can optionally specify a program to use as the input. The confiration file is a JSON file, ending with extention .json, that represents the flow of the pipes. The configuration file schema is:

{
  "input": <program object>,
  "pipes": [<modified program object>]
}

Where <program object> has the schema:

{
  "bin": "/path/to/program/to/spawn",
  "args": ["array", "of", "arguments", "for", "program", "to", "spawn"]
}

And <modified program object> is the same as a <program object> but with an optional pipes property (which has the same schema as before).

The input configuration property is optional. If it is not present, pipeline-manifold will require the start of the pipe flow to be on its stdin. If the property is present, then the application defined by the property will be the source of the flow, via the application's stdout.

Each application defined in a pipes property must accept its input on stdin and return its output on stdout.

As an example, the following configuration will source its flow from an application, pipe into an application that writes the input to /tmp/flow1.out, and into a second application that transforms the input which then flows into a third application that writes the modified input to /tmp/flow2.out:

{
  "input": {
    "bin": "/usr/bin/tail",
    "args": ["-n", "0", "-F", "/var/log/system.log"]
  },
  "pipes": [
    { "bin": "/usr/bin/tee", "args": ["/tmp/flow1.out"] },
    {
      "bin": "/usr/local/bin/modder",
      "args": [],
      "pipes": [{ "bin": "/usr/bin/tee", "args": "/tmp/flow2.out" }]
    }
  ]
}

Tip: the configuration file can be a regular Node.js script as long as module.exports is assigned an object that matches the required schema and the file name ends with the extension .js.

License

MIT License