1.0.0 • Published 9 years ago

any-stream v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

any-stream

NPM version License Build status

Make any function that takes string input (as the first argument) streamable.

Installation

npm install any-stream

Usage

API

anyStream(fn, ...args)

Make fn streamable by leveraging through2 to pass the contents of a stream first and then any consecutive arguments to it.

Example

var fs           = require('fs')
var anyStream    = require('any-stream')
var htmlMinifier = require('html-minifier').minify

var input  = fs.createReadStream('src/index.html')
var output = fs.createWriteStream('dist/index.html')

input
  .pipe(anyStream(htmlMinifier, {
    collapseWhitespace: true,
    removeComments: true
  }))
  .pipe(output)