Skip to content

SerialPort doesn't function as a socket #5

@pcprince

Description

@pcprince

I'm attempting to use xmodem to send data to a serial port. The API and code comments suggest this is possible. However if a SerialPort is given to the send function:

serialPort = new SerialPort(port, {baudRate: 9600}, false);
xmodem.send(port, buffer);

The following error occurs:

.\node_modules\xmodem.js\lib\index.js:221 Uncaught (in promise) TypeError: socket.on is not a function
    at Xmodem.send (.\node_modules\xmodem.js\lib\index.js:221)
    at ReadLineParser.<anonymous> (app.js:490)
    at ReadLineParser.emit (events.js:200)
    at addChunk (_stream_readable.js:294)
    at readableAddChunk (_stream_readable.js:271)
    at ReadLineParser.Readable.push (_stream_readable.js:210)
    at ReadLineParser.Transform.push (_stream_transform.js:150)
    at ReadLineParser._transform (.\node_modules\@serialport\parser-delimiter\delimiter.js:35)
    at ReadLineParser.Transform._read (_stream_transform.js:189)
    at ReadLineParser.Transform._write (_stream_transform.js:177)

Does this package not support SerialPort?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions