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-jssamc2samc3samc4samc5sam-carouselresponsive-react-appsupercluster-googlemaps-adapter-clonessplit-requiresequelcomponentreyhan-projecttestapasvelte-component-libtextfield-samplevue-compmentuzimakeke-testvue-dev-clone@simstudio/htmldiff@brucearmstrong/sass-librarylayui-customdfeuk-frontenddfeuk-frontend-manualmigrate-to-graphmiguelcostero-ng2-toastymiracle-webpack-tree-shakingmississippi2help-widgetgrid-component-react-ex-1jesusdemojeuxuijamuskalimhy-gbprofile3hy-gbprofile5hy-gbprofile6hy-gbprofile7hy-gbprofile8hy-groupportrait2hy-groupportrait3hy-gbprofile-ahhy-gbprofile-xfhy-gbprofile2interleave-streamm2m-chartjs-plugin-crosshairlitepie-datepicker-gabeleo-sdkjulienp-netlifykrown_login_libraryhot-zone-vuehubot-budahypercore-sparse-indexhyperampguruwayguruway.jshcm-jsl2forlernalamos-to-jsonparvan_componentsparvan_reactjs_componentsorigami-build-toolsprova-2-caroselloprova-cmpprova-cpm-2prova-cpm-3prova-cpm-4ng-search-dropdownmyreuselibraryn8n-nodes-caldavn8n-nodes-cobaltmyui5librarychenmyui5librarymoboqyx-hmtldiffreact-form-component-libraryreact-redux-demo1react-otp-input-uptdreact-picky-with-clearnewtmgrnetlify-lightnetlify-clinois-react-toastrangoli-cssreact-misc-toolboxqa_hddreconcile-setsregression-external-dto
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

8 years ago

1.0.1

8 years ago

1.0.0

9 years ago