@furkot/import-csv
v3.0.0
Published
Import CSV files into node.
Downloads
5
Readme
@furkot/import-csv
Import CSV files into Furkot road trip planner.
Install
$ npm install --save furkot-import-csv
Usage
Use as a transform stream: pipe network responses, files etc. and listen on data
event.
const furkotImportCsv = require('@furkot/import-csv');
const { body } = await fetch('https://example.com/my.csv');
const from = body.pipeThrough(new TextDecoderStream());
const trip = await furkotImportCsv(from);
console.log(trip);
Format
CSV files imported by Furkot are expected to have following fields:
name
- place name; mandatorylat
- latitude of the place; mandatory unlessaddress
is providedlon
- longitude of the place; mandatory unlessaddress
is providedaddress
- place address as comma-delimited string; mandatory unlesslat
andlon
are providedurl
- place url; optionalnotes
- place description up to 256 characters; optionalpin
- icon representing the place, from the list of Furkot icons; optionalduration
- stop duration in minutes; optional
If the first line of the imported file contains the names, fields can be in any order and only mandatory ones need to be present. In the absence of the header line with field names, fields in the file have to be exactly in the order listed above.
Any text field that contains commas (specifically the address
) has to be enclosed in double-
quotes, e.g. "1022 William T Morrissey Boulevard, Dorchester, MA 02122, USA".
License
MIT © code42day