Vizabi CSV reader
The main goal of this repo is to provide ability for Vizabi to work with CSV data.
Install
npm i vizabi-csv-reader
Usage
Usage on backend
;;; globald3 = ;globalVizabi = ; const readText = { fs;}; const CsvReader = globalVizabiReader;const csvReaderObject = path: path additionalTextReader: readText;const result = await csvReaderObject; console;
Usage on frontend
Get assets on backend
;; globald3 = ;globalVizabi = ; const readJson = { fs;}; const CsvReader = globalVizabiReader;const csvReaderObject = assetsPath: 'path to asset file' additionalJsonReader: readJson;const result = await csvReaderObject; console;
Initial parameters
path
- path to csv file that would be processedtimeInColumns
- a flag that indicates that CSV file contains data intime-in-columns
format (false by default)lastModified
- last modification date (optional)delimiter
- CSV delimiter character (optional)keySize
- key size (1 by default)hasNameColumn
- an extra column that contains country name (should not be processed, optional, false by default)nameColumnIndex
- index ofnameColumn
(default value is 0)assetsPath
- path to assets JSON file (optional)additionalTextReader
- function that should replace tenured text reading function (optional, see examples above, could be useful on frontend or testing)additionalJsonReader
- function that should replace tenured JSON reading function (optional, see examples above, could be useful on frontend or testing)
Run tests
npm test
Build
git clone https://github.com/vizabi/vizabi-csv-reader.git
cd vizabi-csv-reader
npm i
npm run build
The result is a couple of directories: dist
and lib
.
dist
contain two files: vizabi-csv-reader.js
and vizabi-csv-reader.js.map
. These files could be used
on frontend: see Usage on frontend
lib
(lib/index.js
) - is used 'by default' (see main
section of package.json
) and could be used on
backend (see Usage on backend
)