Big update!Announcing Socket for GitHub 1.0. Learn more
Socket
BlogLoveFAQ
Install
Log in

minipass-collect

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Issues
File Explorer

Advanced tools

minipass-collect

A Minipass stream that collects all the data into a single chunk

    1.0.2latest

Version published
Maintainers
1
Weekly downloads
11,200,119
decreased by-4.3%

Weekly downloads

Readme

Source

minipass-collect

A Minipass stream that collects all the data into a single chunk

Note that this buffers ALL data written to it, so it's only good for situations where you are sure the entire stream fits in memory.

Note: this is primarily useful for the Collect.PassThrough class, since Minipass streams already have a .collect() method which returns a promise that resolves to the array of chunks, and a .concat() method that returns the data concatenated into a single Buffer or String.

USAGE

const Collect = require('minipass-collect') const collector = new Collect() collector.on('data', allTheData => { console.log('all the data!', allTheData) }) someSourceOfData.pipe(collector) // note that you can also simply do: someSourceOfData.pipe(new Minipass()).concat().then(data => ...) // or even, if someSourceOfData is a Minipass: someSourceOfData.concat().then(data => ...) // but you might prefer to have it stream-shaped rather than // Promise-shaped in some scenarios.

If you want to collect the data, but also act as a passthrough stream, then use Collect.PassThrough instead (for example to memoize streaming responses), and listen on the collect event.

const Collect = require('minipass-collect') const collector = new Collect.PassThrough() collector.on('collect', allTheData => { console.log('all the data!', allTheData) }) someSourceOfData.pipe(collector).pipe(someOtherStream)

All minipass options are supported.

FAQs

What is minipass-collect?

A Minipass stream that collects all the data into a single chunk

Is minipass-collect popular?

The npm package minipass-collect receives a total of 9,032,796 weekly downloads. As such, minipass-collect popularity was classified as popular.

Is minipass-collect well maintained?

We found that minipass-collect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 30 Sep 2019
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc