through2-sync

0.2.2 • Public • Published

through2-sync npm version

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

/through2-sync/

    Package Sidebar

    Install

    npm i through2-sync

    Weekly Downloads

    4

    Version

    0.2.2

    License

    Unlicense

    Last publish

    Collaborators

    • valeriangalliat