Created
June 26, 2014 19:45
-
-
Save giacecco/4ca026b9402534924469 to your computer and use it in GitHub Desktop.
TypeError: object is not a function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .../OLAF-fully-automated-ingestion$ foreman run node test.js | |
| /Users/giacecco/Projects/OLAF-fully-automated-ingestion/test.js:4 | |
| csv() | |
| ^ | |
| TypeError: object is not a function | |
| at Object.<anonymous> (/Users/giacecco/Projects/OLAF-fully-automated-ingestion/test.js:4:1) | |
| at Module._compile (module.js:456:26) | |
| at Object.Module._extensions..js (module.js:474:10) | |
| at Module.load (module.js:356:32) | |
| at Function.Module._load (module.js:312:12) | |
| at Function.Module.runMain (module.js:497:10) | |
| at startup (node.js:119:16) | |
| at node.js:906:3 | |
| .../OLAF-fully-automated-ingestion$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var csv = require('csv'), | |
| fs = require('fs'); | |
| csv() | |
| .from.stream(fs.createReadStream(__dirname + '/pp-1995.csv')) | |
| .to.path(__dirname + '/sample.out') | |
| .on('record', function(row,index){ | |
| console.log('#' + index + ' ' + JSON.stringify(row)); | |
| }) | |
| .on('end', function(count){ | |
| console.log('Number of lines: ' + count); | |
| callback(null); | |
| }) | |
| .on('error', function(error){ | |
| console.log(error.message); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment