diff --git a/src/streamHandler/InfluxPointToLineProtoStream.js b/src/streamHandler/InfluxPointToLineProtoStream.js new file mode 100644 index 0000000..a8fc40b --- /dev/null +++ b/src/streamHandler/InfluxPointToLineProtoStream.js @@ -0,0 +1,22 @@ +const logger = require.main.require("./helper/logger.js")("InfluxPointToLineProtoStream"); +const { Transform } = require("stream"); + +/** + * Get points and converts them to Line-protocol + */ +class InfluxPointToLineProtoStream extends Transform{ + constructor(){ + super({ + writableObjectMode: true + }); + } + + _transform(point, encoding, next){ + next(null, point.toLineProtocol() +"\n"); + } +} + +// Specify exports +module.exports = { + InfluxPointToLineProtoStream +}; \ No newline at end of file