new streams

This commit is contained in:
Jan Prochazka
2020-06-10 21:35:25 +02:00
parent 26120969de
commit 1695fb2fd8
7 changed files with 77 additions and 27 deletions

View File

@@ -0,0 +1,16 @@
const stream = require('stream');
class ObjectWriterStream extends stream.Writable {
_write(chunk, enc, next) {
console.log(JSON.stringify(chunk));
next();
}
}
async function consoleObjectWriter() {
return new ObjectWriterStream({
objectMode: true,
});
}
module.exports = consoleObjectWriter;