any-stream
v1.0.0
Published
Make any function that takes string input streamable.
Downloads
1
Maintainers
Readme
any-stream
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)