mafintosh / csv-parser

Streaming csv parser inspired by binary-csv that aims to be faster than everyone else
MIT License
1.41k stars 134 forks source link

Not sure how/if this could be wrapped in a syncronius function #186

Closed GBora closed 3 years ago

GBora commented 3 years ago

Documentation Is:

Please Explain in Detail...

Hi, I'm not sure if this is possible but I was looking for an example of how to wrap this in a synchronous function, what I mean is I want to do something like

let readCSV = (filename) => {
    let result = [];
   // use the library to read all the data in filename and put it in result
    return result;
};
// then somewhere else in my codebase 
const readCSV = require('readCSV.json');
// read some file, I want it not to move to the next line until everithing is done and I have the data
let myArray = readCSV('my-data.csv');
filteredData = _.filter(myData, row => row.id === row.oldId)

Your Proposal for Changes

shellscape commented 3 years ago

It can't. Embrace asynchronous patterns. It's the node way.