2.0.0 • Published 7 years ago

flush-write-stream v2.0.0

Weekly downloads
11,704,417
License
MIT
Repository
github
Last release
7 years ago

flush-write-stream

A write stream constructor that supports a flush function that is called before finish is emitted

npm install flush-write-stream

build status

Usage

var writer = require('flush-write-stream')

var ws = writer(write, flush)

ws.on('finish', function () {
  console.log('finished')
})

ws.write('hello')
ws.write('world')
ws.end()

function write (data, enc, cb) {
  // i am your normal ._write method
  console.log('writing', data.toString())
  cb()
}

function flush (cb) {
  // i am called before finish is emitted
  setTimeout(cb, 1000) // wait 1 sec
}

If you run the above it will produce the following output

writing hello
writing world
(nothing happens for 1 sec)
finished

API

var ws = writer([options], write, [flush])

Create a new writable stream. Options are forwarded to the stream constructor.

var ws = writer.obj([options], write, [flush])

Same as the above except objectMode is set to true per default.

License

MIT

mississippivuedragdropuploadimageskilli8n-react-native-fast-image@arisageha/react-lazyload@cashremit/cr-streamline-iconsbb-chat@frxf/frxf@fundefund/funde_ckgql_din_mod@l1nyanm1ng/react-picture-viewerjs4cytoscape@saaspe/components@everything-registry/sub-chunk-1685test-carosello-campusvue-button-test1webchewescheme-jssupercluster-googlemaps-adapter-clonessplit-requiretestapasvelte-component-libtextfield-samplevue-compmentuzimakeke-testvue-dev-clonejeuxuijesusdemojulienp-netlifyjamuskalimhypercore-sparse-indexhyperamphubot-budahot-zone-vuegrid-component-react-ex-1hcm-jsguruwayguruway.jshelp-widgetinterleave-streamhy-gbprofile-ahhy-gbprofile-xfhy-gbprofile2hy-gbprofile3hy-gbprofile5hy-gbprofile6hy-gbprofile7hy-gbprofile8hy-groupportrait2hy-groupportrait3litepie-datepicker-gabeleo-sdkm2m-chartjs-plugin-crosshairl2forlernalamos-to-jsonkrown_login_library@thismr/bitmindtest-core@tillschweneker/ckeditor5-build-strapi-wysiwyg-markdown@udooku/react-image-comparison-slider@torchlabs/netlify-cli@tonysusi/vapid@thedoctor0/vuex-shared-mutations@vitali_shcherbina/styled-lib@zerowastemap/bankai@zh0st/evm-chains@zebracompany/f_editoralisselisss-lab3a_react_reflux_demob2x-utilsarifbudixzap-vue-captchaappcharge-checkout@openpolitica/matomo-next@oriduk/ckeditor5-rebuild-musicanote@oriduk/ckeditor5-rebuild-oriduk@hproinformatica/functions@hrdtbs/netlify@hypha/web-compiler@innodata/vue-v3-ya-metrika@inesfidalgo/forge@inti-ar/evm-chains@icetee/react-recaptcha-v3@ikon-x/ckeditor5-custom-build-for-irrosoft@igniswap/igni-swap-lib@podlubnaja/ui-kit@poondestroyer/sig@percent/percent-api-hooksgetusermedia-to-textfrdrk-js-semaphorefsaolfs-duplex-streamforminput-ui-libfn-lib-examplefork-react-ffmpeggenerate-feed@shivarajapple/first-libraryeasyplayer-myeditorjs-alerticonsfastlion-picture-viewerfirst-app-lyfuciflowable-bpmn-modeler
2.0.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.3

8 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

10 years ago