Name: await-stream-ready
Owner: node_modules
Description: a promise waiting stream ready
Created: 2017-03-24 16:31:09.0
Updated: 2018-05-14 05:28:04.0
Pushed: 2017-03-27 07:27:02.0
Homepage: null
Size: 10
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A promise waiting stream ready
i await-stream-ready --save
Wait a read stream
t fs = require('fs');
t awaitReadStream = require('await-stream-ready').read;
c function read(file) {
nst stream = fs.createReadStream(file);
ream.on('data', buf => {
// consume buf
;
ait awaitReadStream(stream);
Or wait a write stream
t fs = require('fs');
t awaitWriteStream = require('await-stream-ready').write;
c function write(srcStream, file) {
nst stream = srcStream.pipe(fs.createWriteStream(file));
ait awaitWriteStream(stream);
It will switch the readable stream to flowing mode automatically.