1.0.0 • Published 7 years ago

writa v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

writa

a generic node stream_writable function

install

$ npm i writa

use

const writa = require('writa')

/* first obtain the source stream */
const { createReadStream } = require('fs')
const r = createReadStream('readme.markdown')

/* obtain a writable destination by passing a function to writa */
const s = writa(function (chunk, _, next) {

  /* consume readable's data */
  console.log(chunk+'')

  /* callback moves stream forward to next chunk */
  next()
})

/* pipe to it now from some source stream, like readable */
r.pipe(s)

test

npm t

related art

MIT