Created
October 19, 2015 14:37
-
-
Save josser/d79993e93ff627eaa4fb 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
var parser = parse({delimiter: ',', columns: ['code', 'date', 'open', 'high', 'low', 'close', 'volume', 'f0']}); | |
var saver = transform(function(asset, cb) { | |
models.MetastockHistory.create({ | |
code: asset['code'], | |
date: moment(asset['date'], 'YYYYMMDD').format(), | |
price: parseFloat(asset['close']) | |
}).then(function (result) { | |
cb(null, result); | |
}); | |
}); | |
fs.createReadStream(filePath).pipe(parser).pipe(saver); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment