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

csv-string

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-string - npm Package Compare versions

Comparing version 3.0.3 to 3.1.0

20

lib/streamer.js
'use strict';
var Writable = require('stream').Writable;
var Transform = require('stream').Transform;
var Parser = require('./parser.js');
function Streamer(options) {
Writable.call(this, options);
Transform.call(this, {
readableObjectMode: true,
writableObjectMode: false,
});
this.buffer = '';

@@ -14,9 +17,8 @@ this.sep = (options && options.separator) ? options.separator : undefined;

Streamer.prototype = Object.create(
Writable.prototype, { constructor: { value: Streamer }});
Transform.prototype, { constructor: { value: Streamer }});
Streamer.prototype._write = function (chunk, encoding, done) {
Streamer.prototype._transform = function(chunk, encoding, done) {
this.buffer = this.buffer.concat(chunk.toString());
if (this.sep === undefined) {

@@ -42,3 +44,3 @@ // try to detect the separator if not provided

rows.forEach(function (row) {
self.emit('data', row);
self.push(row);
}

@@ -50,3 +52,3 @@ )

Streamer.prototype.end = function () {
Streamer.prototype._flush = function (done) {
var csv = new Parser(this.buffer, this.sep, this.quo);

@@ -57,9 +59,9 @@ var rows = csv.File();

rows.forEach(function (row) {
self.emit('data', row);
self.push(row);
}
)
}
this.emit('end');
done();
};
module.exports = Streamer;
{
"name": "csv-string",
"version": "3.0.3",
"version": "3.1.0",
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>",

@@ -5,0 +5,0 @@ "contributors": [

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