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@cybermega/flutter-resource-manager-rsjeuxuijesusdemojesh-calculationkydraiiif-manifest-editorhot-zone-vuegundam5luojia-cli-devmangudinlagirajinmanan-react-native-expo-authorize-netlabtesttwokrown_login_librarymd-vditor@tillschweneker/ckeditor5-build-strapi-wysiwyg-markdown@tomw2w/my-nuxt-layer@vitali_shcherbina/styled-lib@zebracompany/f_editoranakketigaanaklanangteaanakwadonteaagent-get-agentained-ckeditor5astra-ufo-sdkarchlibraryappcharge-checkout@parallelnft/web3modal@openpolitica/matomo-next@orgbluetooth/react-native-arunpayupayment@orgbluetooth/react-native-payupayment@oriduk/ckeditor5-rebuild-musicanote@oriduk/ckeditor5-rebuild-oriduk@opn-ooo/eslint-config-opn@icetee/react-recaptcha-v3@ikon-x/ckeditor5-custom-build-for-irrosoft@idas1/ui-component-lib@podlubnaja/ui-kit@positionex/position-sdk@ozancakir/ckeditor5-build-inline-balloon@plogg/threegerimismalamseninfrdrk-js-semaphorefn-lib-examplegamification-integration-new@shivarajapple/first-library@ssossou/styletool@swiizyyy/discord-akairo@taymoon/ckeditor5-custom-builddogandev-simple-toastes-react-bridgeemr-tabulator-tableseslint-config-k3cman-angularera-ckeditor5evanutilsfixed_form_builderflowable-bpmn-modeler@abhinavoneuipoc/stencil-test@blkmarketco/components-library@buganto/client@cdk8s-extensions/argo-rolloutcandlelabssdkckeditor-5-imi-1ck-wy-1ckeditor5-build-custom-kockeditor5-build-custom-strapickeditor5-custom-build-for-irrosoftckeditor5-strapi-msgckeditor5-custom-ksckeditor5-custom-symmetreckeditor5-custom-build-tn-pluginckeditor5-custom-build-megampireck-wyckeditor5-build-yektackeditor5-click-virtualckeditor5-build-classic-ticket
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