mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 15:25:59 +00:00
new streams
This commit is contained in:
16
packages/api/src/shell/consoleObjectWriter.js
Normal file
16
packages/api/src/shell/consoleObjectWriter.js
Normal 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;
|
||||
Reference in New Issue
Block a user