Implement converter-stream point -> lineProtocol
This commit is contained in:
		
							parent
							
								
									d1cf1d8f7d
								
							
						
					
					
						commit
						f596a99ee6
					
				
							
								
								
									
										22
									
								
								src/streamHandler/InfluxPointToLineProtoStream.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/streamHandler/InfluxPointToLineProtoStream.js
									
									
									
									
									
										Normal file
									
								
							@ -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
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user