Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

NodeGuy/concat-stream-p

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

concat-stream-p

concat-stream is commitment-phobic so I made a promise interface wrapper which accepts all of concat-stream's options. See its documentation first.

Installation

npm install concat-stream-p

Example

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

var readStream = fs.createReadStream('cat.png')

readStream.on('error', handleError)

readStream.pipe(concat()).then(function (imageBuffer) {
  // imageBuffer is all of `cat.png` as a node.js Buffer
})

function handleError(err) {
  // handle your error appropriately here, e.g.:
  console.error(err) // print the error to STDERR
  process.exit(1) // exit program with non-zero exit code
}

Interface

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

concat(options = {})

Returns a stream.Writable that's also a promise of all of the data that was written to the stream.

About

concat-stream with a promise interface

Resources

License

Stars

Watchers

Forks

Packages

No packages published