aws-s3-facia-tool
Advanced tools
Comparing version 0.4.5 to 0.4.6
@@ -8,4 +8,5 @@ { | ||
"collectionsPrefix": "frontsapi/collection", | ||
"pressedPrefix": "frontsapi/pressed", | ||
"maxParallelRequests": 6, | ||
"maxDaysHistory": 7 | ||
} | ||
} |
@@ -30,2 +30,18 @@ var AWS = require('aws-sdk'); | ||
exports.headObject = function (object, callback) { | ||
var inCache = cache.key(object.Key), | ||
cachedContent = inCache.get(); | ||
if (cachedContent) { | ||
return callback(null, cachedContent); | ||
} | ||
s3.headObject(object, function (err, data) { | ||
if (!err) { | ||
inCache.store(JSON.stringify(data)); | ||
} | ||
callback(err, data); | ||
}); | ||
}; | ||
exports.listObjects = function (object, callback) { | ||
@@ -32,0 +48,0 @@ var inCache = cache.key(object.Prefix), |
@@ -9,2 +9,3 @@ var aws = require('./aws'); | ||
var History = require('./history'); | ||
var Press = require('./press'); | ||
@@ -15,2 +16,4 @@ function FaciaTool (options) { | ||
this.history = new History(this); | ||
this.press = new Press(this); | ||
} | ||
@@ -17,0 +20,0 @@ |
{ | ||
"name": "aws-s3-facia-tool", | ||
"description": "Iterate on S3 buckets in facia tool", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"main": "lib/facia-tool.js", | ||
"dependencies": { | ||
"async": "^1.2.1", | ||
"aws-sdk": "^2.1.34", | ||
"es6-promise": "^2.3.0", | ||
"lodash": "^3.9.3", | ||
"async": "^1.5.2", | ||
"aws-sdk": "^2.2.32", | ||
"es6-promise": "^3.0.2", | ||
"lodash": "^4.0.1", | ||
"mkdirp": "^0.5.1", | ||
"moment": "^2.10.3", | ||
"sift": "^1.1.1" | ||
"moment": "^2.11.1", | ||
"sift": "^3.2.0" | ||
}, | ||
@@ -28,7 +28,7 @@ "scripts": { | ||
"devDependencies": { | ||
"chai": "^3.0.0", | ||
"istanbul": "^0.3.15", | ||
"jscs": "^1.13.1", | ||
"jshint": "^2.8.0", | ||
"mocha": "^2.2.5" | ||
"chai": "^3.4.1", | ||
"istanbul": "^0.4.2", | ||
"jscs": "^2.9.0", | ||
"jshint": "^2.9.1", | ||
"mocha": "^2.3.4" | ||
}, | ||
@@ -35,0 +35,0 @@ "repository": { |
@@ -121,2 +121,37 @@ /*jshint -W030 */ | ||
it('head object - error', function (done) { | ||
aws.setS3({ | ||
headObject: function (obj, callback) { | ||
callback(new Error('something wrong')); | ||
} | ||
}); | ||
aws.headObject({ | ||
Key: 'unit_test/head_object' | ||
}, function (err) { | ||
expect(err).to.be.an.instanceof(Error); | ||
done(); | ||
}); | ||
}); | ||
it('head - works fine', function (done) { | ||
aws.setS3({ | ||
headObject: function (obj, callback) { | ||
callback(null, { | ||
LastModified: 'long time ago' | ||
}); | ||
} | ||
}); | ||
aws.headObject({ | ||
Key: 'unit_test/head_object' | ||
}, function (err, data) { | ||
expect(err).to.be.null; | ||
expect(data).to.deep.equal({ | ||
LastModified: 'long time ago' | ||
}); | ||
done(); | ||
}); | ||
}); | ||
}); |
71219
39
2309
+ Addedcall-bind-apply-helpers@1.0.2(transitive)
+ Addedes6-promise@3.3.1(transitive)
+ Addedfor-each@0.3.5(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedsift@3.3.12(transitive)
- Removedcall-bind-apply-helpers@1.0.1(transitive)
- Removedes6-promise@2.3.0(transitive)
- Removedfor-each@0.3.4(transitive)
- Removedlodash@3.10.1(transitive)
- Removedsift@1.1.1(transitive)
Updatedasync@^1.5.2
Updatedaws-sdk@^2.2.32
Updatedes6-promise@^3.0.2
Updatedlodash@^4.0.1
Updatedmoment@^2.11.1
Updatedsift@^3.2.0