JSPM

  • Created
  • Published
  • Downloads 30257204
  • Score
    100M100P100Q234439F

writable stream that concatenates strings or data and calls a callback with the result

Package Exports

  • concat-stream

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (concat-stream) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

concat-stream

npm install concat-stream

then

var concat = require('concat-stream')
var fs = require('fs')

var read = fs.createReadStream('readme.md')
var write = concat(function(err, data) {})

read.pipe(write)

works with arrays too!

var write = concat(function(err, data) {})
write.write([1,2,3])
write.write([4,5,6])
write.end()
// data will be [1,2,3,4,5,6] in the above callback

works with buffers too! can't believe the deals!

var write = concat(function(err, data) {})
write.write(new Buffer('hello '))
write.write(new Buffer('world'))
write.end()
// data will be a buffer that toString()s to 'hello world' in the above callback

MIT LICENSE