TypeError: csv(...).fromStream is not a function
See original GitHub issueFor the below code,
var csvfile = "../voter/test.csv";
var fs = require("fs");
var csv = require("fast-csv");
var stream = fs.createReadStream(csvfile);
var csvStream = csv()
.fromStream(stream, { headers: true })
.on("data", function(data) {
console.log(data);
})
.on("end", function() {
console.log(" End of file import");
});
stream.pipe(csvStream);
I am getting the following error,
.fromStream(stream, { headers: true })
^
TypeError: csv(...).fromStream is not a function
at Object.<anonymous> (/***/test.js:26:4)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
I crossed check the library files, the function is present. Anything I have missed out?
Node version : v8.12.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Node js does not parse the csv file using fast-csv library
Put the csv into a variable and then use stream.pipe() with it. Like this: var csvStream = csv .fromStream(stream, {headers : true}) ...
Read more >fast-csv.fromStream JavaScript and Node.js code examples
Best JavaScript code snippets using fast-csv. ... csv.fromStream(stream, {headers : true}) .on("data", function(data){ console.log(data); }) .on("end", ...
Read more >Top 5 fast-csv Code Examples - Snyk
To help you get started, we've selected a few fast-csv examples, based on popular ways it is used in public projects. · fast-csv...
Read more >CSV parser and writer
fromStream (stream, options); function fast-csv.parse. ... objectMode = true; if (has(options, "transform")) { // remove so its not set to _transform in ...
Read more >TypeError: csv is not a function in Nodejs - DevOps
TypeError : csv is not a function in Nodejs ... I am getting the following error in Nodejs, when I use a csv...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is because you might be using upper version of fast-csv package. try to use 2.4.1
Yep, this works for me. Thanks!