From e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Mon, 16 Nov 2020 00:10:28 +0100 Subject: api, login, auth --- node_modules/flush-write-stream/example.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 node_modules/flush-write-stream/example.js (limited to 'node_modules/flush-write-stream/example.js') diff --git a/node_modules/flush-write-stream/example.js b/node_modules/flush-write-stream/example.js new file mode 100644 index 0000000..fa6b5da --- /dev/null +++ b/node_modules/flush-write-stream/example.js @@ -0,0 +1,22 @@ +var writer = require('./') + +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 +} -- cgit v1.2.3