/pull-stdio

Stdio functions for pull streams.

Primary LanguageJavaScriptMIT LicenseMIT

pull-stdio NPM version Build Status

Stdio functions for pull streams.

var { stdin, stdout, stderr } = require('pull-stdio')

pull(
  // Source stream for stdin
  stdin(),
  // Sink stream for stdout
  stdout()
)

// Also a sink stream for stderr
pull(
  pull.values(['Error', 'blahlbah']),
  stderr()
)

This module is a simple wrapper around stream-to-pull-stream on the native process.stdio streams. If you have any further ideas for this module feel free to open an issue.

Installation

$ npm install --save pull-stdio

Usage

stdio.{method}

The object which contains the stdio functions stdin, stdout, and stderr for pull streams.

Example

var stdio = require('pull-stdio')

pull(
  stdio.stdin()
  // ...
)

stdin([options])

A source pull stream for Node's process.stdin.

Options

  • encoding (String|false): Set the process.stdin encoding, or to false. Defaults to 'utf8'.

Example

pull(
  stdin({ encoding: false }),
  // ...
)

stdout()

A sink stream for Node's process.stdout.

Example

pull(
  // Source data somewhere
  // Output to stdout:
  stdout()
)

stderr()

A sink stream for Node's process.stderr.

Example

pull(
  // Source data somewhere
  // Output to stderr:
  stderr()
)

License

MIT © Jamen Marz