https://github.com/mfaheemakhtar/csvtojsonfile
A simple Node.js module to convert CSV file to JSON file.
https://github.com/mfaheemakhtar/csvtojsonfile
csv csvtojson json node nodejs npm-module npm-package
Last synced: 8 months ago
JSON representation
A simple Node.js module to convert CSV file to JSON file.
- Host: GitHub
- URL: https://github.com/mfaheemakhtar/csvtojsonfile
- Owner: mfaheemakhtar
- License: mit
- Created: 2017-12-10T15:29:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-10T19:45:11.000Z (over 8 years ago)
- Last Synced: 2025-07-24T02:30:32.682Z (8 months ago)
- Topics: csv, csvtojson, json, node, nodejs, npm-module, npm-package
- Language: JavaScript
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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:
```js
// files are in the same directory
csvtojson('read.csv', 'write.json', err => {
if (err) console.error(err);
else console.log('DONE');
});
```
```js
// 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](https://github.com/mfaheemakhtar/csvtojsonfile/)
Pull requests are also welcome.