parse-csv-stream
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "parse-csv-stream", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Parse any csv file via stream or csv stream from any other source in Node.js for various usecases like database insertion, logging, file creation, batch processing data etc.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -26,15 +26,26 @@ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | ||
//There are 2 approaches you can take : events, stream, choose any one. | ||
/* | ||
There are 2 approaches you can take : | ||
[A.] events. | ||
[B.] streams. | ||
// [1.] working with events. | ||
There are 3 ways to handle data : | ||
[1.] Process each row seperately via events. | ||
[2.] Process resultset (array of rows). | ||
[3.] Pipe parsed stream. | ||
choose any one. | ||
*/ | ||
// [A.] working with events. | ||
events.on('data', (row) => { | ||
console.log(row); | ||
console.log(row); //process each row seperately. | ||
}) | ||
readStream.on('data', (chunk) => { | ||
parser.parse(chunk); | ||
let resultset = parser.parse(chunk); //process resultset (array of rows). | ||
}); | ||
//[2.] Working with streams. | ||
readStream.pipe(parser).pipe(writeStream); | ||
//[B.] Working with streams. | ||
readStream.pipe(parser).pipe(writeStream); //pipe parsed stream. | ||
``` | ||
@@ -41,0 +52,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5550
63