Import geopostcode.com streets file into SQL database with Sequelize.
$ npm install geopostcodes-sequelize-import
var fs = require('fs');
var importerFactory = require('geopostcodes-sequelize-import');
var importer = importerFactory(sequelize, {
// options
});
var csvFilePath = 'path/to/geopostcodes-streets-plus.csv';
var csvStream = fs.createReadStream(csvFilePath);
importer.syncStream(csvStream, function (err) {
if (err) {
throw err;
}
console.log('Sync end!');
});
maxBulkCreate
: (default:500
) Maximum records processed perinsert into
.updateOnDuplicate
: (default:false
) See sequelize doc. Only supported bymysql
&mariadb
Iffalse
, duplicate ID errors can be raised if database is already populated.