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

carrier

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

carrier - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

44

lib/carrier.js

@@ -13,40 +13,20 @@ var util = require('util'),

var line = '';
var buffer = '';
reader.setEncoding(encoding || 'utf-8');
reader.on('data', function(data) {
var lines = data.split("\n");
if (data.charAt(data.length - 1) == "\n") {
// get rid of last "" after last "\n"
lines.pop(1);
}
if (lines.length > 0) {
//console.log('Have ' + lines.length + " lines\n");
lines.forEach(function(one_line, index) {
line += one_line;
var emit = true;
if (index == lines.length - 1) {
// processing last line
if (data.charAt(data.length - 1) != "\n") {
// if it was not terminated by "\n" then the last line was not finished; we just buffer it.
//console.log('last one does not have \n, not emitting');
emit = false;
}
}
if (emit) {
line = line.replace("\r", '');
//console.log('emiting ' + line + "\n");
self.emit('line', line);
line = '';
}
})
}
var lines = (buffer + data).split("\n");
buffer = lines.pop();
lines.forEach(function(line, index) {
line = line.replace("\r", '');
self.emit('line', line);
});
});
var ender = function() {
if (line.length > 0) {
line = line.replace("\r", '');
self.emit('line', line);
line = '';
if (buffer.length > 0) {
buffer = buffer.replace("\r", '');
self.emit('line', buffer);
buffer = '';
}

@@ -53,0 +33,0 @@ self.emit('end');

{ "name" : "carrier"
, "description" : "Evented stream line reader for node.js"
, "version" : "0.1.4"
, "version" : "0.1.5"
, "homepage" : "http://github.com/pgte/carrier"

@@ -5,0 +5,0 @@ , "author" :

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