any-stream

1.0.0 • Public • Published

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)

Package Sidebar

Install

npm i any-stream

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • gummesson