dockerized_openAger/nodered/rootfs/data/node_modules/mailsplit/lib/message-joiner.js

31 lines
655 B
JavaScript
Raw Permalink Normal View History

2020-10-17 16:42:50 +00:00
'use strict';
const Transform = require('stream').Transform;
class MessageJoiner extends Transform {
constructor() {
let options = {
readableObjectMode: false,
writableObjectMode: true
};
super(options);
}
_transform(obj, encoding, callback) {
if (Buffer.isBuffer(obj)) {
this.push(obj);
} else if (obj.type === 'node') {
this.push(obj.getHeaders());
} else if (obj.value) {
this.push(obj.value);
}
return callback();
}
_flush(callback) {
return callback();
}
}
module.exports = MessageJoiner;