You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

csv2object

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv2object - npm Package Compare versions

Comparing version

to
0.0.2

2

package.json
{
"name": "csv2object",
"version": "0.0.1",
"version": "0.0.2",
"description": "A Simple NodeJS library for extracting an array of Javascript Objects from a CSV file. The CSV may also (optionally) be GZipped.",

@@ -5,0 +5,0 @@ "main": "index.js",

# csv2object
A Simple NodeJS library for extracting an array of Javascript Objects from a GZipped CSV. The CSV may also (optionally) be GZipped.
[![Build Status](https://travis-ci.org/MoxieUSA/node-csv2object.svg?branch=master)](https://travis-ci.org/MoxieUSA/node-csv2object)
A Simple NodeJS library for extracting an array of Javascript Objects from a CSV file. The CSV file may also (optionally) be GZipped (`file.csv.gz`).
## Installation
`npm install --save csv2object`
```javascript
var csv2obj = require('csv2object');
```
## Methods
### .load(filePath[,options[,gzipped]])
Returns a **ReadableStream** of the parsed CSV (and optionally unzipped) file.
Returns: **ReadableStream**
Parameters:
* **filePath** - Path to the CSV file
* **options** - Object of options passed through to the [`csv-parser`](https://www.npmjs.com/package/csv-parser) module
* **gzipped** - Boolean of whether the `filePath` file is gzipped (e.g.`file.csv.gz`)
#### Example
```javascript
csv2obj.load('data/mydata.csv.gz', null, true)
.on('data', function(row){
console.log(row);
});
```
### .loadAll(filePath[,csvOptions[,gzipped]])
Returns a **Promise** that resolves with an `Array` of Objects each being a row from the CSV.
Returns: **Promise**
Parameters:
* **filePath** - Path to the CSV file
* **options** - Object of options passed through to the [`csv-parser`](https://www.npmjs.com/package/csv-parser) module
* **gzipped** - Boolean of whether the `filePath` file is gzipped (e.g.`file.csv.gz`)
#### Example
```javascript
csv2obj.loadAll('data/mydata.csv.gz', null, true)
.then(function success(data){
console.log(data); // array of objects
}, function error(err){
console.log(err);
});
```
## Changelog
### 0.0.2
* Added README.md documentation
### 0.0.1
* Initial Release

Sorry, the diff of this file is not supported yet