I just use fs.
require('fs'); // ... readFile: function(path) { var fileContent; return new Promise(function(resolve) { fileContent = fs.readFileSync(path, {encoding: 'utf8'}); resolve(fileContent); }); }
When I use the contents of the file, it's like
stuff,stuff,stuff,stuff,stuff\r\n thing,thing,thing,thing,thing\r\n thing,thing,thing,thing,thing\r\n thing,thing,thing,thing,thing\r\n thing,thing,thing,thing,thing\r\n thing,thing,thing,thing,thing
which is good enough for my purposes.
typo: fileContent = fs.readFileSync(path, {encoding: 'utf8'});
Fixed it now, thanks :)
Hi Kayla, this is awesome! Do you mind if I link to this code snippet in a CSV-parsing dev.to article I'm working on? I'd love to include a purely fs solution. :)
Go for it! :)
Thank you!! Here's the link to the article, with the link to your snippet in the conclusion. :)
dev.to/isalevine/parsing-csv-files...
We're a place where coders share, stay up-to-date and grow their careers.
I just use fs.
When I use the contents of the file, it's like
which is good enough for my purposes.
typo: fileContent = fs.readFileSync(path, {encoding: 'utf8'});
Fixed it now, thanks :)
Hi Kayla, this is awesome! Do you mind if I link to this code snippet in a CSV-parsing dev.to article I'm working on? I'd love to include a purely fs solution. :)
Go for it! :)
Thank you!! Here's the link to the article, with the link to your snippet in the conclusion. :)
dev.to/isalevine/parsing-csv-files...