1.4.4 • Published 5 years ago

end-of-stream v1.4.4

Weekly downloads
25,338,492
License
MIT
Repository
github
Last release
5 years ago

end-of-stream

A node module that calls a callback when a readable/writable/duplex stream has completed or failed.

npm install end-of-stream

Build status

Usage

Simply pass a stream and a callback to the eos. Both legacy streams, streams2 and stream3 are supported.

var eos = require('end-of-stream');

eos(readableStream, function(err) {
  // this will be set to the stream instance
	if (err) return console.log('stream had an error or closed early');
	console.log('stream has ended', this === readableStream);
});

eos(writableStream, function(err) {
	if (err) return console.log('stream had an error or closed early');
	console.log('stream has finished', this === writableStream);
});

eos(duplexStream, function(err) {
	if (err) return console.log('stream had an error or closed early');
	console.log('stream has ended and finished', this === duplexStream);
});

eos(duplexStream, {readable:false}, function(err) {
	if (err) return console.log('stream had an error or closed early');
	console.log('stream has finished but might still be readable');
});

eos(duplexStream, {writable:false}, function(err) {
	if (err) return console.log('stream had an error or closed early');
	console.log('stream has ended but might still be writable');
});

eos(readableStream, {error:false}, function(err) {
	// do not treat emit('error', err) as a end-of-stream
});

License

MIT

Related

end-of-stream is part of the mississippi stream utility collection which includes more useful stream modules similar to this one.

pumpduplexifymississippistream-eachasync-donearchetype-libraryeasy-select-rn@lilpacy/torus-embedvuedragdropuploadimagesreact-native-bluetooth2killi8n-react-native-fast-imagefrontend-master-downloader@ajs031985/skyapm-nodejsrn-send-smsspecify-importsbabel-specify-imports@icanpm/api-master@arisageha/react-lazyloadwebtorrent-jali@cashremit/cr-streamline-iconswebtorrent-fork@tkil/tmpl-clireact-native-template-rfbasecloud-archive-s3airscanairscan-examplebb-chatreact-native-esc-pos-sahaablumi22mqtt@borisovart/atol-kkt-module@thesis-co/mechamittens-extension@frxf/frxfkubii-apideneme323112@dxos/discovery-swarm-webrtc@dxos/feed-level-indexer@dxos/feed-replication-network@dxos/hyperswarm-network-memory@dxos/data-client@texttree/demo-bsa-reference-rcl@fundefund/funde_ck@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjames@dattomy/docker-registry-serverdiscord-music-botsreact-native-covid-sdkeasycommands-betagql_din_modbitgetreact-native-thanh-toast-library@jttechnic/interpreter@thanhnguyen14797/react-native-thanh-toast-library@l1nyanm1ng/react-picture-viewer@saeon/ol-react@saeon/quick-form@iobroker-community-adapters/iobroker.device-watcher@solvencino/fs-streammysql-formatpanqibaoreact-native-printer-brothersrn-pdf-reader-offline@haoadoresorange/gitpkg@newhorizon-tech/dd-npm-package-templatereact-native-shekhar-bridge-testcogoportutilsukor-remasterdyx-reacttemp-mail-fucktalent-to-vite-cliwilscanner@oiti/documentoscopy-react-nativejs4cytoscape@mink-opn/build-tokensquoc-testreact-native-slider-kfone-indexunblock-block-save-variables@infinitebrahmanuniverse/nolb-end@prodam/prodam-types@saaspe/componentsplginexpand-react-bridgeluminos-ui-corewebtorrent-fix@everything-registry/sub-chunk-1585jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgreact-native-jawwy_sample@geeky-apo/react-native-advanced-clipboardka-flow.jskafirchain-tetrisl2forlernalevel-range-emitterlib-errorlit-patient-cardlitepie-datepicker-gabe
1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

6 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

10 years ago

1.0.0

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago