csvtojsonfile
v1.3.0
Published
A simple module to convert a CSV file to JSON file.
Downloads
4
Readme
csvtojsonfile
A simple Node.js module to convert CSV file to JSON file.
How to use:
Install:
npm install csvtojsonfile --save
TIP: You can exclude "--save" if you are using npm 5.
Include:
const csvtojson = require('csvtojsonfile');
OR
import csvtojson from 'csvtojsonfile';
Examples:
// files are in the same directory
csvtojson('read.csv', 'write.json', err => {
if (err) console.error(err);
else console.log('DONE');
});
// files are in another directory
csvtojson('./dir/read.csv', './dir/write.json', err => {
if (err) console.error(err);
else console.log('DONE');
});
NOTE: All parameters are necessary.
Features:
- Simple to use.
- No dependencies. Only uses the core node modules.
- Light-weight -- Just 55 lines of code including comments and blank lines.
- Amazingly fast -- uses Asynchronous file read and write API.
Limitations:
- Does not check for file type.
- Uses JSON.stringify, which is Synchronous.
Support:
If you find errors or bugs, kindly open a issue on GitHub
Pull requests are also welcome.