Skip to content

Instantly share code, notes, and snippets.

@ChrisCates
Created March 5, 2016 17:32
Show Gist options
  • Save ChrisCates/4bdfaeeb130fcce0e943 to your computer and use it in GitHub Desktop.
Save ChrisCates/4bdfaeeb130fcce0e943 to your computer and use it in GitHub Desktop.
async.eachSeries(dirs, function(dir, callback) {
converter = new Converter({});
var file = __dirname + path + "/" + dir;
converter.fromFile(file, function(err,csv) {
var table = dir.replace(".csv", "").toLowerCase();
var count = 0;
async.mapLimit(csv, 100, function(rows, callbackMap) {
r.db("baseball").table(table).insert(rows).then(function() {
count = count + 100;
console.log("Migrated",count,"rows");
callbackMap();
})
})
})
}, function() {
console.log("All done!");
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment