@serialpilot/parser-slip-encoder
v1.0.1
Published
An RFC 1055 SLIP framing encoder/decoder for serial links.
Maintainers
Readme
Streams that encode and decode SLIP (Serial Line Internet Protocol) framing — useful for sending self-delimiting binary frames over a serial link (esp. ESP-IDF firmware tools, embedded MCUs).
npm install @serialpilot/parser-slip-encoderUsage
const { SerialPilot, SlipEncoder, SlipDecoder } = require('serialpilot')
const port = new SerialPilot({ path: '/dev/ttyUSB0', baudRate: 9600 })
const decoder = port.pipe(new SlipDecoder())
decoder.on('data', frame => console.log('frame:', frame))
const encoder = new SlipEncoder()
encoder.pipe(port)
encoder.write(Buffer.from([0x01, 0x02, 0xc0])) // 0xc0 escaped automaticallyAPI
SlipEncoder and SlipDecoder are Transform streams that operate on Buffers. Both honor the standard SLIP byte values (END=0xC0, ESC=0xDB, ESC_END=0xDC, ESC_ESC=0xDD).
See the SerialPilot README for the full set of parsers.
