Skip to content

Instantly share code, notes, and snippets.

@sbower

sbower/block4.js Secret

Created March 8, 2017 21:26
Show Gist options
  • Save sbower/68113ad4228bfef3bd237b252c42d689 to your computer and use it in GitHub Desktop.
Save sbower/68113ad4228bfef3bd237b252c42d689 to your computer and use it in GitHub Desktop.
var data_stream = new ReadableStream();//new stream.Readable();
var gzip = zlib.createGzip();
// create parameters hash for table scan
var params = {TableName: tablename, ReturnConsumedCapacity: 'NONE', Limit: '1'};
// body will contain the compressed content to ship to s3
var body = data_stream.pipe(gzip);
var s3obj = new aws.S3({params: {Bucket: 'ccu-dynamo-backups', Key: tablename + '/' + tablename + '-' + ts + '.gz'}});
s3obj.upload({Body: body}).
on('httpUploadProgress', function(evt) {
console.log(evt);
}).
send(function(err, data) { console.log(err, data); callback(); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment