SenecaImportCSV
Import a CSV into Seneca
Standalone Usage
Install
$ npm install seneca-import-csv -g
Run
$ seneca-import-csv.js -f your-csv.csv -e your-entity -c ./example-config.jsonchecking [===================] 100% 0.0simporting [== ] 14% 16.8s
You can also specify a -r file
flag to say when and how to resume the
import.
Config Example
The importer supports both a JSON-based configuration and a module-based configuration.
JSON configuration
"store": "jsonfile-store" "opts": "folder": "./db"
module-based configuration
module { seneca return Joiobject}
See the documentation of Joi for all
the possible options with defining the schema.
The options passed to the Joi.validate
functions are convert: true
and stripUnknown: true
.
JSON configuration
Auto resume
SenecaImportCSV allows to resume a previously stopped (or crashed) import sequence.
$ seneca-import-csv.js -f your-csv.csv -e your-entity -c ./example-config.json -r resume-filechecking [===================] 100% 0.0simporting [ ] 6% 19.6s^C$ seneca-import-csv.js -f your-csv.csv -e your-entity -c ./example-config.json -r resume-filechecking [===================] 100% 0.0sskipping 502 rowsimporting [== ] 14% 8.7s^C
Embedded Usage
Install
npm install seneca-import-csv --save
Import as Entities
var seneca = importer = seneca seneca
Import by Acting
var seneca = importer = pear = seneca pattern = sample: 'call' instance = importer { console } s; instanceinstanceinstance
Acknowledgements
This project was kindly sponsored by nearForm.
License
MIT