2.0.0 • Published 5 years ago

flush-write-stream v2.0.0

Weekly downloads
11,704,417
License
MIT
Repository
github
Last release
5 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/componentsnetlify-cli@everything-registry/sub-chunk-1685easyplayer-myeditorjs-alerticons@podlubnaja/ui-kit@sgrove/netlify-cli@sackmanson/quill-image-uploader@shivarajapple/first-libraryorigami-build-tools@poondestroyer/sig@seculum/vue-dev-clonewebche@kirrosh/ptscssesc-wbgvformlmq@lofcz/sweetalert2-neutraldemo-component-skyflyer86npm-all-packages@openpolitica/matomo-nextdesign-system-fitbank-450nois-react-toastvue-button-test1vue-compmentvue-dev-clonemiracle-webpack-tree-shaking@ericmcornelius/ease@hrdtbs/netlify@elsouza1985/react-org-chartmississippi2case-gg-editortestapacampus-carosellocampus1campus2campus3campus4@headgum/tko-mapping@lego-js/testsuzimakeke-test@litedexdev/litedex-core-swap@krwhitley/neatapticunshorten-pinboard-urlsdat-rmverify-img-code@kristoffertonning/vue-laravel-errors@leonardodino/netlifywescheme-jsparvan_componentsparvan_reactjs_components@react-18-pdf/root@southcn/ckeditor5-build-inline@stansaal/ckeditor5-custom-build@percent/percent-api-hooks@safely-project/safely-ts@oriduk/ckeditor5-rebuild-musicanotedfeuk-frontenddfeuk-frontend-manual@oriduk/ckeditor5-rebuild-oriduk@thedoctor0/vuex-shared-mutations@rbc-public/react-selectable-fast@skeetboothppq/component-librarycourse-vue-tplcpm-defcpm-15cpm-16cpm-17cpm-18cpm-19cpm-20cpm-21cpm-5cpm-10cpm-11cpm-12cpm-13cpm-14cpm-6cpm-7cpm-8cpm-9custompackagetestvarthinicustomized-netlify-cling-search-dropdowndigital-keyboard-demosvue-v3-yandex-metrikadiscordjs-con-selfdiscord.js-bycon@farvater/open-pedigree
2.0.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

6 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago