callback-stream
A pipeable stream that calls your callback
Last updated 9 years ago by matteo.collina .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install callback-stream 
SYNC missed versions from official npm registry.

CallbackStream

BuildStatus

It is a safe variant of the concat-stream package that will always return an array.

It does everything callback-stream does, minus the concatenation. In fact, it just callbacks you with an array containing your good stuff.

It is based on the Stream 2 API, but it also works on node v0.8. It also support Stream 3, which is bundled with node v0.12 and iojs.

Installation

npm install callback-stream --save

Pipe usage

var callback = require('callback-stream')
var fs = require('fs')
var read = fs.createReadStream('readme.md')
var write = callback(function (err, data) {
  console.log(err, data)
})

read.pipe(write)

Object mode usage

var callback = require('callback-stream')
var write = callback.obj(function (err, data) {
  // this will print ['hello', 'world']
  console.log(data)
})

write.write('hello')
write.write('world')
write.end()

Contributing to CallbackStream

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

LICENSE - "MIT License"

Copyright (c) 2013-2015 Matteo Collina, http://matteocollina.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Current Tags

  • 1.1.0                                ...           latest (9 years ago)

4 Versions

  • 1.1.0                                ...           9 years ago
  • 1.0.2                                ...           11 years ago
  • 1.0.1                                ...           11 years ago
  • 1.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (4)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE