Last active
August 11, 2016 10:02
-
-
Save timwis/e7185c2935d49d84bd32257bc990b14b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
client.select('*').from(opts.table).stream() | |
.pipe(through.obj(chunkToFiles)) | |
.pipe(vfs.dest('./' + opts.table)) | |
function chunkToFiles (chunk, enc, callback) { | |
const primaryKey = chunk[opts.primaryKey] | |
const keys = Object.keys(chunk) | |
keys.forEach((key) => { | |
const file = new File({ | |
path: `./${primaryKey}/${key}`, | |
contents: new Buffer(chunk[key] + '') | |
}) | |
this.push(file) | |
}) | |
callback() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment