dsv-loader

A webpack module to load dsv (e.g. .csv or .tsv) files.

3 years after

Webpack dsv loader

A Webpack plugin for loading dsv files (for example .csv).

Installation

Install via npm:

npm install --save dsv-loader

Usage

You can require dsv data like this:

var data = require('dsv!./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 dsv files like this: require('data.csv') , you can add the dsv-loader to your webpack config:

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

Options

delimiter

Tells the loader which delimiter is used to seperate the data. Default: ','

Examples:

var data = require('dsv?delimiter=;!./data.csv'); //load data seperated by semicolon

var data = require('dsv?delimiter=x!./data.csv'); //load data seperated by an 'x'

Credits

  • Inspired by webpack's json-loader
  • DSV parsing done with dsv by Mike Bostock

Related Repositories

csv-loader

csv-loader

A webpack module to intelligently load csv files ...

chiasm-dataset-loader

chiasm-dataset-loader

A Chiasm component that fetches datasets over HTTP. ...

vega-loader

vega-loader

Network request and file loading utilities. ...


Top Contributors

chrtze g-div moklick underbluewaters andybry taion mnbbrown wegry