Git Product home page Git Product logo

callback2stream's Introduction

Transform sync, async or generator function to Stream. Correctly handle errors and optional arguments.

code climate standard code style travis build status coverage status dependency status

Install

npm i callback2stream --save

Usage

For more use-cases see the tests

const callback2stream = require('callback2stream')

Create a stream from sync, async or generator function.

Params

Example

var fs = require('fs')
var cb2stream = require('callback2stream')

var readFileStream = cb2stream(fs.readFile)
var stream = readFileStream('package.json', 'utf8')
stream
  .on('data', function (val) {
    var json = JSON.parse(val)
    console.log(json.name) // => 'callback2stream'
  })
  .once('error', console.error)
  .once('end', function () {
    console.log('reading finished')
  })

// you also have access to the
// contents with promise
stream.promise
  .then(JSON.parse, console.error)
  .then(function (val) {
    console.log(val.name) // => 'callback2stream'
  }, console.error)
  .catch(console.error)

Related

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

tunnckoCore.tk keybase tunnckoCore tunnckoCore npm tunnckoCore twitter tunnckoCore github

callback2stream's People

Contributors

greenkeeper[bot] avatar greenkeeperio-bot avatar tunnckocore avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

callback2stream's Issues

An in-range update of is-buffer is breaking the build 🚨

Version 1.1.5 of is-buffer just got published.

Branch Build failing 🚨
Dependency is-buffer
Current Version 1.1.4
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As is-buffer is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ coverage/coveralls Coverage pending from Coveralls.io Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 5 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of pre-commit is breaking the build 🚨

Version 1.1.3 of pre-commit just got published.

Branch Build failing 🚨
Dependency pre-commit
Current Version 1.1.2
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As pre-commit is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

  • βœ… coverage/coveralls First build on greenkeeper/pre-commit-1.1.3 at 98.969% Details

Commits

The new version differs by 11 commits .

  • 0f0833a [dist] 1.1.3
  • fa6119d Merge pull request #57 from blacksonic/master
  • 2abd42b Merge pull request #64 from kevinoid/relative-link
  • 1a04430 Make pre-commit hook symlink relative
  • 2ca2fb9 Merge pull request #60 from saiichihashimoto/patch-1
  • b6e63d7 Update README.md
  • 4510f45 [fix] add .bashrc to supported home files
  • 3f83f72 Merge pull request #54 from fhemberger/fix/dependencies
  • 683221f Merge pull request #53 from fhemberger/fix/travis
  • 53ec6e9 Update dependencies
  • eb7ac24 [travis] Add [email protected], use new container infrastructure

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of mukla is breaking the build 🚨

Version 0.4.5 of mukla just got published.

Branch Build failing 🚨
Dependency mukla
Current Version 0.4.4
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mukla is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

  • βœ… coverage/coveralls First build on greenkeeper/mukla-0.4.5 at 98.969% Details

Commits

The new version differs by 2 commits .

  • 703d308 0.4.5
  • 3b7d301 switch to always-done, fix errors output (should externalize it)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

use `redolent@2`

redolent will be same as letta without the handling of unhandledRejection and uncaughtException events, because that thing is bit dangerous/not so expected and may be confusing.

An in-range update of pre-commit is breaking the build 🚨

Version 1.2.2 of pre-commit just got published.

Branch Build failing 🚨
Dependency pre-commit
Current Version 1.2.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As pre-commit is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • βœ… coverage/coveralls First build on greenkeeper/pre-commit-1.2.2 at 98.969% Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 2 commits .

  • bf393ad [dist] 1.2.2
  • 675560c Use string instead of int 777 in fs.chmodSync so it gets correctly interpreted as octal (#90)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of lazy-cache is breaking the build 🚨

Version 2.0.2 of lazy-cache just got published.

Branch Build failing 🚨
Dependency lazy-cache
Current Version 2.0.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As lazy-cache is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

  • βœ… coverage/coveralls First build on greenkeeper/lazy-cache-2.0.2 at 98.969% Details

Commits

The new version differs by 3 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.