JSPM

cli-streams

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q27066F
  • License MIT

A duplex stream of process.stdin/stdout or filestreams depending on cli options

Package Exports

  • cli-streams

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cli-streams) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cli-streams

A pair of streams - process.stdin/stdout or filestreams depending on cli option overrides

installation

$ npm install cli-streams

usage

A module to use when a cli program will accept stdin and write to stdout but can optionally redirect either to a filestream.

var args = require('minimist').parse(process.argv, {
    i:'input',
  o:'output'
})
var resolve = require('cli-path-resolve')
var clistreams = require('cli-streams')
var through = require('through2')

var streams = clistreams(resolve(args.input), resolve(args.output))

streams.input.pipe(through(function(chunk, enc, next){
    this.push(chunk.toString().toUpperCase())
})).pipe(streams.output)

api

var pair = streams(inputPath, outputPath)

return an object with 2 streams:

  • input - either process.stdin or a file readStream if input param exists
  • output - either process.stdout or a file readStream if input param exists

license

MIT