JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 23767
  • Score
    100M100P100Q142205F

A webpack module to intelligently load csv files.

Package Exports

  • csv-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (csv-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Webpack csv loader

NPM

Installation

Install via npm:

npm install -S csv-loader

Usage

You can require csv data like this:

var data = require('csv!./data.csv');
// => returns data.csv content as json parsed object

The loader will translate the data.csv file into a JSON Object.

Usage with webpack.config

To require csv files like this: require('data.csv') , you can add the csv-loader to your webpack config:

module : {
  loaders : [
    { test: /\.csv$/, loader: 'csv-loader' } //will load all .csv files with csv-loader by default
  ]
}

Options

header

Tells the loader to look for a CSV header or not. Default: true

var data = require('csv?-header!./data.csv'); //No header

dynamicTyping

Tells the loader to automatically convert data types Default: true

var data = require('csv?-dynamicTyping!./data.csv'); //Disable dynamic typing

comments

Allows comments in the CSV file Default: false

var data = require('csv?+dynamicTyping!./data.csv'); //Enable comments

Credits