🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

csv-to-array

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-to-array

A library for converting CSV files to JSON arrays.

1.0.2
latest
Source
npm
Version published
Weekly downloads
317
-21.14%
Maintainers
3
Weekly downloads
 
Created
Source

CSV To Array

A library for converting CSV files to JSON arrays.

Installation

Run the following commands to download and install the application:

Install

$ npm install csv-to-array

Documentation

CsvToArray(options, callback)

Converts CSV files to JSON arrays.

Example

  • File content:

    1;2;3
    4;5;6
    
var columns = ["column1", "column2", "column3"];
require("csv-to-array")({
   file: "path/to/input/file.csv",
   columns: columns
}, function (err, array) {
  console.log(err || array);
});

Output:

[
    {
        "column1": "1",
        "column2": "2",
        "column3": "3"
    },
    {
        "column1": "4",
        "column2": "5",
        "column3": "6"
    }
]

Params

  • Object options: Object containing the following fields:

  • csvOptions (Object): The options that will be passed to the a-csv module (default: {}).

  • file (String): The CSV file path.

  • collumns (Array): An array of strings with the columns from CSV file.

  • Function callback: The callback function.

How to contribute

  • File an issue in the repository, using the bug tracker, describing the contribution you'd like to make. This will help us to get you started on the right foot.
  • Fork the project in your account and create a new branch: your-great-feature.
  • Commit your changes in that branch.
  • Open a pull request, and reference the initial issue in the pull request message.

Changelog

1.0.1

  • Update in documantation.

1.0.0

  • Initial stable version.

License

See the LICENSE file.

Keywords

csv

FAQs

Package last updated on 15 Mar 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