🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
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

A Simple NodeJS library for extracting an array of Javascript Objects from a CSV file. The CSV may also (optionally) be GZipped.

1.0.0
latest
Source
npm
Version published
Weekly downloads
4
-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

csv2object

Build Status

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

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 module
  • gzipped - Boolean of whether the filePath file is gzipped (e.g.file.csv.gz)

Example

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 module
  • gzipped - Boolean of whether the filePath file is gzipped (e.g.file.csv.gz)

Example

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

1.0.0

  • Move and cleanup repository

0.0.2

  • Added README.md documentation

0.0.1

  • Initial Release

Keywords

node

FAQs

Package last updated on 17 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts