Created
March 5, 2016 17:32
-
-
Save ChrisCates/4bdfaeeb130fcce0e943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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