TypeError: Object #<SerialPort> has no method 'drain'
Hi, when drain method is called
serialPort.drain(function(err, result){
console.log(err, result);
});
I am getting the error
TypeError: Object #<SerialPort> has no method 'drain'
Also
cat node_modules/serialport/serialport.js | grep drain
returns nothing.
How can I empty the serial port?
All data the port has read will be emitted (usually by the raw parser as a data event). You would need to use the event emitter syntax however.
port.on('data', function(){}))
Only the line parser will buffer any data, and there is no way to drain it. It is simple to construct your own if you need access to its buffer. On Nov 14, 2013 8:39 AM, "ediazal" [email protected] wrote:
Hi, when drain method is called
serialPort.drain(function(err, result){ console.log(err, result); });
I am getting the error
TypeError: Object #
has no method 'drain' Also
cat node_modules/serialport/serialport.js | grep drain
returns nothing.
How can I empty the serial port?
— Reply to this email directly or view it on GitHubhttps://github.com/voodootikigod/node-serialport/issues/260 .
Thanks. It helped to know data isn't buffered to solve my problem :)
Anyways, It would be nice to be able to read the port data using a Stream
We'd like to be a stream eventually =)