node package manager

geopostcodes-sequelize-import

geopostcodes-sequelize-import

Build Status

Import geopostcode.com streets file into SQL database with Sequelize.

Installation

$ npm install geopostcodes-sequelize-import

Example Usage

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!');
});

Options

  • maxBulkCreate : (default: 500) Maximum records processed per insert into.
  • updateOnDuplicate : (default: false) See sequelize doc. Only supported by mysql & mariadb If false, duplicate ID errors can be raised if database is already populated.