Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serialport

Package Overview
Dependencies
Maintainers
0
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serialport - npm Package Compare versions

Comparing version 0.2.0 to 0.2.2

._AUTHORS

2

._package.json

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR`�s��"�"com.macromates.caret{
Mac OS X  2��ATTRk�V��"�"com.macromates.caret{
column = 22;
line = 1;
}

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR`�u��#�#com.macromates.caret{
column = 31;
line = 68;
Mac OS X  2��ATTRk�X��#�#com.macromates.caret{
column = 34;
line = 14;
}
{ "name" : "serialport",
"version" : "0.2.0",
"version" : "0.2.2",
"description" : "Welcome your robotic javascript overlords. Better yet, program them!",

@@ -4,0 +4,0 @@ "author": "Chris Williams <voodootikigod@gmail.com>",

@@ -15,3 +15,3 @@ <pre>

Version: 0.2 - Released March 8, 2011
Version: 0.2.2 - Released March 19, 2011

@@ -18,0 +18,0 @@ *****

@@ -25,11 +25,24 @@ "use strict";

readline: function (delimiter) {
if (!delimiter) { delimiter == "\r" }
if (typeof delimiter === "undefined" || delimiter === null) { delimiter = "\r"; }
// Delimiter buffer saved in closure
var data = "";
return function (emitter, buffer) {
var lines = buffer.toString().split(delimiter);
lines.forEach(function (i) {
emitter.emit('data', i);
})
}
// Collect data
data += buffer.toString();
// Split collected data by delimiter
data.split(delimiter).forEach(function (part, i, array) {
if (i !== array.length-1) {
// Fully delimited part. Lets emit it.
emitter.emit('data', part);
}
else {
// Last split part might be partial. We can't emit it just yet.
data = part;
}
});
};
}
}
};

@@ -78,10 +91,16 @@

var buffer = new Buffer(_options.buffersize);
var bytes_read = serialport_native.read(file_id, buffer);
var bytes_read = 0, err = null;
try {
bytes_read = serialport_native.read(file_id, buffer);
}
catch (e) {
err = e;
}
if (bytes_read <= 0) {
// assume issue with reading.
me.emit("error", "Read triggered, but no bytes available. Assuming error with serial port shutting down.");
me.readWatcher.stop();
me.emit("error", (err ? err :"Read triggered, but no bytes available. Assuming error with serial port shutting down."));
me.close();
}
_options.parser(me, buffer.slice(0, bytes_read));
}
};
})(this.fd, this);

@@ -96,2 +115,4 @@ this.readWatcher.set(this.fd, true, false);

SerialPort.prototype.close = function () {
this.readWatcher.stop();
if (this.fd) {

@@ -101,2 +122,3 @@ serialport_native.close(this.fd);

}
};

@@ -110,6 +132,6 @@

serialport_native.write(this.fd, new Buffer(b));
}
};
module.exports.SerialPort = SerialPort;
module.exports.parsers = parsers;
module.exports.parsers = parsers;

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR`�}��#�#com.macromates.caret{
Mac OS X  2��ATTRk�_��#�#com.macromates.caret{
column = 26;
line = 11;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc