Socket
Socket
Sign inDemoInstall

cp-pipe

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cp-pipe

Pipe stdout and stderr from child processes without typing as much code.


Version published
Maintainers
1
Created

Readme

Source

cp-pipe

Pipe stdout and stderr from child processes without typing as much code.

install

npm install cp-pipe

example

Require the module and make some processes:

const cpPipe = require('cp-pipe')

const a = spawnA()
const b = spawnB()
const c = spawnC()
cpPipe.chainToProcess([a, b, c])

// vs

a.stdout.pipe(b.stdin)
b.stdout.pipe(c.stdin)
c.stdout.pipe(process.stdout)

a.stderr.pipe(process.stderr)
b.stderr.pipe(process.stderr)
c.stderr.pipe(process.stderr)
cpPipe.outIn([a, b, c])

// vs

a.stdout.pipe(b.stdin)
b.stdout.pipe(c.stdin)
cpPipe.err([a, b, c], process)

a.stderr.pipe(process.stderr)
b.stderr.pipe(process.stderr)
c.stderr.pipe(process.stderr)

API

cpPipe.chainToProcess(processes)

  • processes: [] Array of child processes

Pipes the stdout of a prior process from processes into the stdout of the next process, chaining the stdouts/stdins together, pipes the stdout of the last process to process.stdout, and pipes the stderrs of all processes to process.stderr.

cpPipe.outIn(processes)

  • processes: [] Array of child processes

Pipes the stdout of a prior process from processes into the stdout of the next process, chaining the stdouts/stdins together.

cpPipe.err(processes, destProcess)

Pipes the stderrs of all processes to destProcess.stderr.

Keywords

FAQs

Last updated on 09 Feb 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc