2.0.0 • Published 6 years ago

flush-write-stream v2.0.0

Weekly downloads
11,704,417
License
MIT
Repository
github
Last release
6 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-clone@ctfdio/picocss-themes@ct-note/table@ct-note/warning@ct-note/image@ct-note/inline-code@ct-note/list@ct-note/marker@ct-note/paragraph@ct-note/quote@ct-note/simple-image@ct-note/checklist@ct-note/code@ct-note/delimiter@ct-note/embed@ct-note/header@cube-design/react@blkmarketco/components-library@beldore/react-otp-input@percent/percent-api-hooks@rbc-public/react-selectable-fastjeuxuijesusdemojulienp-netlifyjamuskalim@simstudio/htmldiff@brucearmstrong/sass-librarylayui-customdfeuk-frontenddfeuk-frontend-manualstream-to-neo4jstnenopmoc-iustock-ticker-react-widgetspace-shuttletingzi-vuepresstinymce-plugin-toyu-libraryto2@aschmidt8/netlify-cli@artiso-solutions/vue-html-to-paper@arielapaula/components@arielapaula/test@adpt/core@axerunners/blockchain-spv@blitzjs/file-pipeline@carhoo/widget-dealers@abtnode/util@benovshe/sasslibrary@dgoguerra/sql-cli@dashevo/blockchain-spvvue-v3-yandex-metrikaunshorten-pinboard-urlsverify-img-codevformlmq@farvater/open-pedigree@headgum/tko-mapping@hproinformatica/functions@hrdtbs/netlify@icetee/react-recaptcha-v3@elsouza1985/react-org-chart@gradebook/netlify-deploy@innodata/vue-v3-ya-metrika@kristoffertonning/vue-laravel-errors@krwhitley/neataptic@lofcz/sweetalert2-neutral@lego-js/tests@leonardodino/netlify@isogand/react-native-sliding-counter@inti-ar/evm-chains@litedexdev/litedex-core-swap@meysam213/react-leaflet@ericmcornelius/ease@fabwcie/ckeditor5-preview@faizanhaider/iconsax@min98/layui-custom@jarrydark/editorsimplejs
2.0.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.3

7 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago