Skip to content

Releases: reqshark/writa

Release list

v1.0.0

Choose a tag to compare

@reqshark reqshark released this 20 Jun 21:41

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)