@rumras/csvparse
v1.0.2
Published
Simple package for parsing csv
Downloads
2
Readme
MorningScore_test - npm package for parsing a CSV to JSON
Short test from MorningScore
Lightweight?: It got nothing but a very simple function to change from the csv format to a JSON format. It could be considered to handle alot of different issues regarding parsig of csv files, but for this scope only a few things are handled.
- Removing whitespaces before/after text/numbers in fields
- It's possible to change from a comma separated file to other kinds of separated files (fx. semicolon).
Install by using - "npm install @rumras/csvparse"
Example code for reading a file and running it
""" var csvparse = require("@rumras/csvparse/csvparse") let fs = require('fs')
getFile();
async function getFile() { const path = "./sample_csv/airtravel_long.csv" const text = await fs.readFileSync(path); console.log(csvparse.csvToJson(text)) } """
SAMPLES
csv samples borowed from https://people.sc.fsu.edu/~jburkardt/data/csv/csv.html