Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

cancelable-pump

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Issues
File Explorer

Advanced tools

cancelable-pump

Cancelable `pump`

    0.4.0latest
    GitHub

Version published
Maintainers
1
Weekly downloads
407
decreased by-37.09%

Weekly downloads

Readme

Source

cancelable-pump

npm version Build Status Coverage Status

Cancelable pump

const {createReadStream, createWriteStream} = require('cancelable-pump'); const cancelablePump = require('cancelable-pump'); cancelablePump(createReadStream('1GB-file.txt'), createWriteStream('dest0'), () => { statSync('dest0').size; //=> 1000000000; }); const cancel = cancelablePump(createReadStream('1GB-file.txt'), createWriteStream('dest1'), () => { statSync('dest1').size; //=> 263192576, or something else smaller than 1000000000 }); setTimeout(() => { cancel(); }, 1000);

Installation

Use npm.

npm install cancelable-pump

API

const cancelablePump = require('cancelable-pump');

cancelablePump(stream0 [, stream1, stream2, ...] [, callback])

stream0, stream1, stream2, ...: Stream
callback: Function
Return: Function

cancelablePump(streams [, callback])

streams: Array<Stream>
callback: Function
Return: Function

The API is almost the same as pump's. The only difference is cancelable-pump returns a function to destroy all streams without passing any errors to the callback.

const cancel = cancelablePump([src, transform, anotherTransform, dest], err => { err; //=> undefined }); cancel();

License

ISC License © 2017 - 2018 Shinnosuke Watanabe

Keywords

FAQs

Last updated on 14 May 2018

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc