danielgindi / node-csv-reader

A CSV stream reader, with many many features, and ability to work with the largest datasets
MIT License
35 stars 11 forks source link

Typo in npm readme #2

Closed rozetko closed 6 years ago

rozetko commented 6 years ago

Hi! I noticed you have typo in example in your npm readme. https://www.npmjs.com/package/csv-reader#usage-example

var fs = require('fs');
var CsvReadableStream = require('csv-reader');
var AutoDetectDecoderStream = require('autodetect-decoder-stream');

var inputStream = fs.createReadStream('my_data.csv')
    .pipe(new AutoDetectDecoderStream({ defaultEncoding: '1255' })); // If failed to guess encoding, default to 1255 

// The AutoDetectDecoderStream will know if the stream is UTF8, windows-1255, windows-1252 etc. 
// It will pass a properly decoded data to the CsvReader. 

inputStream
    .pipe(CsvReader({ parseNumbers: true, parseBooleans: true, trim: true }))
    .on('data', function (row) {
        console.log('A row arrived: ', row);
    }).on('end', function (data) {
        console.log('No more rows!');
    });

Guess it should look like this (CsvReader ->CsvReadableStream, like in your github readme):

var fs = require('fs');
var CsvReadableStream = require('csv-reader');
var AutoDetectDecoderStream = require('autodetect-decoder-stream');

var inputStream = fs.createReadStream('my_data.csv')
    .pipe(new AutoDetectDecoderStream({ defaultEncoding: '1255' })); // If failed to guess encoding, default to 1255 

// The AutoDetectDecoderStream will know if the stream is UTF8, windows-1255, windows-1252 etc. 
// It will pass a properly decoded data to the CsvReader. 

inputStream
    .pipe(CsvReadableStream({ parseNumbers: true, parseBooleans: true, trim: true }))
    .on('data', function (row) {
        console.log('A row arrived: ', row);
    }).on('end', function (data) {
        console.log('No more rows!');
    });
danielgindi commented 6 years ago

It is actually okay on Github, just not pushed to npm...

danielgindi commented 6 years ago

Published :-)

rozetko commented 6 years ago

@danielgindi, thx!