lib/gtfsLoader.js
function () {
    insertCfg.model.sync({force: true}).then(function () {
      var streamInserterCfg = util.makeStreamerConfig(insertCfg.model)
      var inserter = dbStreamer.getInserter(streamInserterCfg)

      inserter.connect(function (err) {
        if (err) return callback(err)
        csv()
          .fromFile(insertCfg.filename)
          .on('json', line => {
            inserter.push(transformer2(line))
          })
          .on('done', err => {
            if (err) return callback(err)
            inserter.setEndHandler(callback)
            inserter.end()
          })
      })
    })
  }
function () {
    insertCfg.model.sync({force: true}).then(function () {
      var streamInserterCfg = util.makeStreamerConfig(insertCfg.model)
      var inserter = dbStreamer.getInserter(streamInserterCfg)

      inserter.connect(function (err) {
        if (err) return callback(err)
        csv()
          .fromFile(insertCfg.filename)
          .on('json', line => {
            inserter.push(transformer2(line))
          })
          .on('done', err => {
            if (err) return callback(err)
            inserter.setEndHandler(callback)
            inserter.end()
          })
      })
    })
  }
function ( ) { insertCfg . model . sync ( { force : true } ) . then ( function ( ) { var streamInserterCfg = util . makeStreamerConfig ( insertCfg . model ) var inserter = dbStreamer . getInserter ( streamInserterCfg ) inserter . connect ( function ( err ) { if ( err ) return callback ( err ) csv ( ) . fromFile ( insertCfg . filename ) . on ( 'json' , line => { inserter . push ( transformer2 ( line ) ) } ) . on ( 'done' , err => { if ( err ) return callback ( err ) inserter . setEndHandler ( callback ) inserter . end ( ) } ) } ) } ) }
prepare processing function, but don't run it until file existance is confirmed
prepare processing function but don t run it until file existance is confirmed