through2-sync
v0.2.2
Published
Synchronous through2 transforms.
Downloads
4
Readme
through2-sync
Synchronous through2 transforms.
Description
The API is the same as through2 (including the through.obj
helper), but the callback function is synchronous.
Example
const Stream = require('stream')
const through = require('through2-sync')
const stream = new Stream.Readable()
stream._read = () => {}
stream
.pipe(through(
chunk => chunk.toString().toUpperCase(),
() => 'last chunk\n'
))
.pipe(process.stdout)
stream.push('hello\n') // HELLO
stream.push('world\n') // WORLD
stream.push(null) // last chunk