Skip to content

Commit

Permalink
S3 prefix is a parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Chadburn committed Feb 24, 2014
1 parent e1215b0 commit ad76f44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 7 additions & 2 deletions bin/s3get
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ var program = require('commander')

program
.version('0.0.1')
.option('-b, --bucket', 'Bucket')
.option('-b, --bucket [name]', 'Bucket')
.option('-p, --prefix [path]', 'Prefix')
.parse(process.argv);

// aws-frontend-logs/PROD/access.log/2014/02/22/frontend-router
// var date = moment(new Date()).subtract(moment.duration(2, 'd')).format('YYYY/MM/DD');
// util.format('PROD/access.log/%s/frontend-router', date)

s3get.go({
bucket: 'aws-frontend-logs'
bucket: program.bucket,
prefix: program.prefix
})
8 changes: 3 additions & 5 deletions lib/aws-parallel-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ var AWS = require('aws-sdk')
async = require('async'),
util = require('util');


exports.go = function (opts) {

AWS.config.loadFromPath('./config.json');

var s3 = new AWS.S3();
var bucket = opts.bucket;
var date = moment(new Date()).subtract(moment.duration(2, 'd')).format('YYYY/MM/DD')
, prefix = util.format('PROD/access.log/%s/frontend-router', date)
var s3 = new AWS.S3()
, bucket = opts.bucket
, prefix = opts.prefix;

s3.listObjects({
Bucket: bucket,
Expand Down

0 comments on commit ad76f44

Please sign in to comment.