2.0.1 • Published 2 years ago

minipass-collect v2.0.1

Weekly downloads
7,656,771
License
ISC
Repository
github
Last release
2 years ago

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.

cacachevuedragdropuploadimagesbb-chat@texttree/demo-bsa-reference-rcl@fundefund/funde_ck@saeon/ol-react@saeon/quick-formcogoportutils@mink-opn/build-tokens@infinitebrahmanuniverse/nolb-minip@saaspe/componentsexpand-react-bridgenode-gio@everything-registry/sub-chunk-2175jawwy-sdkreact-native-sphereuisphereuitest-iki-mini-appwinx-form-winxweb-elements-iconswow.js-juzisupercluster-googlemaps-adapter-clonestestujsk_custom_ckeditor5svelte-component-libvantiq-react@drblmthw/testujsk_custom_ckeditor5@cybermega/flutter-resource-manager-rs@blkmarketco/components-library@positionex/position-sdkjeuxuijesusdemojesh-calculationkydrasushi-sdk-ftm@castrum-nubis/bulmazzzxxxyyy321123styletoolsstock-ticker-react-widgettehmusimhujanud7-act2u-librarytldrawlignin@asiz33/smartblok-vendure-plugin@aviinash_jha/react-native-test_multiply@ali5049/react-native-buttons@buganto/client@cdk8s-extensions/argo-rollout@cleveradssolutions/cas.cordova.ironsource@cleveradssolutions/cas.cordova.kidoz@cleveradssolutions/cas.cordova.mintegral@cleveradssolutions/cas.cordova.mytarget@cleveradssolutions/cas.cordova.optimal@cleveradssolutions/cas.cordova.pangle@cleveradssolutions/cas.cordova.superawesome@cleveradssolutions/cas.cordova.tapjoy@cleveradssolutions/cas.cordova.unity@cleveradssolutions/cas.cordova.vungle@cleveradssolutions/cas.cordova.yandex@cleveradssolutions/cas.cordova.adcolony@cleveradssolutions/cas.cordova.admob@cleveradssolutions/cas.cordova.applovin@cleveradssolutions/cas.cordova.facebook@cleveradssolutions/cas.cordova.families@cleveradssolutions/cas.cordova.fyber@cleveradssolutions/cas.cordova.inmobi@abhinavoneuipoc/stencil-testzerionprokovanmail@parallelnft/web3modal@farvater/open-pedigree@harsha-jalan/ckeditor5-custom-build@hoaitt/ckeditor5-build-classic-mention@idas1/ui-component-lib@icetee/react-recaptcha-v3@edwinpb/scany@krenaldi/learnstorybook-design-system-template@labiebhn_/react-native-multiplier@lego-js/tests@marinaga/bananize@enirisdev/angular-google-charts@fabwcie/ckeditor5-preview@faizanhaider/iconsax@ikon-x/ckeditor5-custom-build-for-irrosoft@hieuquang2212/form@juanzenn/ckeditor5-custom-build@saeon/logger@sackmanson/quill-image-uploader@samwinslow/edgedb@saqib1987/quiz_test@openpolitica/matomo-next@podlubnaja/ui-kit@plogg/three@oriduk/ckeditor5-rebuild-oriduk@oriduk/ckeditor5-rebuild-musicanote@opn-ooo/eslint-config-opn@ozancakir/ckeditor5-build-inline-balloon@stansaal/ckeditor5-custom-buildmynancemiracle-webpack-tree-shakingori-bot-react-nativenuxtpaginations
2.0.1

2 years ago

2.0.0

2 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago