Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

csv-array

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-array

This is a CSV parser created and made for nodeJS. Which takes a csv file and produce an array from it

  • 0.0.11
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
increased by40.69%
Maintainers
1
Weekly downloads
 
Created
Source

#csv-array

Simple. lighweight, intelligent CSV-parser for nodeJS

Dependencies

This package got only one dependency of "fs". You may install that first using following command

npm install fs

Usage Guide

After installing the package you can use the "parseCSV" method as follows

 parseCSV("CSV-file-name.csv", callBack)
 //where callBack is a function having the argument data 
 //which is an array structure of the CSV file

Example

 var csv = require('csv-array');
 csv.parseCSV("test.csv", function(data){
   console.log(JSON.stringify(data));
 });

If the test.csv file contains something like this

 Question Statement,Option 1,Option 2,Option 3,Option 4,Option 5,Answer,Deficulty,Category
this is a test question answer it?,answer 1,answer 2,answer3,answer 4,,answer 2,3,test
this is another test question answer it?,"answer1,answer2","answer2,answer3","answer4,answer5","answer5,answer6","answer7,answer8","answer1,answer2",2,test

Then the resulting array is as follows

[{"Question Statement":"this is a test question answer it?","Option 1":"answer 1","Option 2":"answer 2","Option 3":"answer3","Option 4":"answer 4","Option 5":"","Answer":"answer 2","Deficulty":"3"},{"Question Statement":"this is another test question answer it?","Option 1":"answer1,answer2","Option 2":"answer2,answer3","Option 3":"answer4,answer5","Option 4":"answer5,answer6","Option 5":"answer7,answer8","Answer":"answer1,answer2","Deficulty":"2"}]

FAQs

Package last updated on 21 Apr 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc