Overview
This library helps decode DLT logs (Diagnostic Log and Trace):
- from stream (being connected to DLT demon)
- from file
Installation
npm install dltreader --save
Usage
Decode file
Example of file reading.
;; ; // Create transform object// Bellow see more about options for DLT transform object; // Create null writable stream (we do not want in this example to write any data, it's just reading.// If you need write data, just create real writable stream; // Or real sctream/*const writer: fs.WriteStream = fs.createWriteStream('some_desination_file.txt');*/ // Create file reader (for original DLT file); // This event is triggered: when chunk is read and decodedtranform.onDLT.TransformStream.Events.chunk,; // Listen moment of complite to read filereader.on'end',; // Start readingreader.pipetranform.pipewriter, ;
Run-time decode stream
Example of reading DLT-demon
;; ;; // Create DLT buffer; // Create object to count incoming packages; // Array to store errors; // "packet" event triggers with each decoded packagedltbuffer.onDLT.Buffer.Events.packet,; // "error" event triggers if decoding of package was failed. Process of listening / decoding isn't stoppeddltbuffer.onDLT.Buffer.Events.error,; // Create connection to DLT demon; // Start listening connectionsocket.on'data',; // Listen errors of connectionsocket.on'error',; // Do not forget to close application with closing of connectionsocket.on'close',;