Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Feb 26, 2024 via pnpm

pump 2.0.1

pipe streams together and close all of them if one of them closes
Package summary
Share
0
issues
2
licenses
2
MIT
2
ISC
Package created
14 Aug 2013
Version published
22 Jan 2018
Maintainers
1
Total deps
4
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
end-of-stream@1.4.4
pump@2.0.1

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
once@1.4.0
wrappy@1.0.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of pump 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
end-of-stream1.4.42.33 kBMIT
prod
once1.4.01.93 kBISC
prod

Visualizations

Frequently Asked Questions

What does pump do?

Pump is a small and effective Node.js module that serves the purpose of piping streams together and destroys all of them if one closes. This module resolves the issue in Node.js where using source.pipe(dest), the source won't be destroyed if dest emits close or an error, and it's not possible to provide a callback when the pipe is finished. Pump handles these two issues seamlessly.

How do you use pump?

To incorporate Pump in your Node.js project, you first need to install it using npm by running npm install pump in your terminal. Once you've done this, you can start using Pump in your code by requiring it like this var pump = require('pump'). The basic usage is quite straightforward - you need to pass the streams you wish to pipe together to pump, and optionally add a callback function. Here's a basic example:

var pump = require('pump')
var fs = require('fs')

var source = fs.createReadStream('/dev/random')
var dest = fs.createWriteStream('/dev/null')

pump(source, dest, function(err) {
  console.log('pipe finished', err)
})

setTimeout(function() {
  dest.destroy() // when dest is closed pump will destroy source
}, 1000)

In this example, a source stream is created that reads from '/dev/random' and a destination stream is created to write to '/dev/null'. These streams are piped together using pump, and a callback is provided that logs when the pipe is finished. After 1 second, the destination stream is destroyed, which in turn causes pump to destroy the source stream.

Pump can also be used to pipe more than two streams together as well like this:

var transform = someTransformStream()

pump(source, transform, anotherTransform, dest, function(err) {
  console.log('pipe finished', err)
})

In this case, if any of source, transform, anotherTransform, or dest closes, all of them will be annihilated.

Where are the pump docs?

The complete documentation and information for Pump can be found in its README file in the GitHub repository (git://github.com/mafintosh/pump.git). The README offers a detailed explanation about what the module does, how to use it with code examples, and the problems it can solve. Further information can be accessed through the provided link to the Mississippi Stream Utility Collection, where you can find related and useful stream modules.