in source/custom-resource/lib/website-helper.js [230:265]
let downloadWebsiteManifest = function(s3Bucket, s3Key, downloadLocation, cb) {
let params = {
Bucket: s3Bucket,
Key: s3Key
};
console.log(params);
// check to see if the manifest file exists
s3.headObject(params, function(err, metadata) {
if (err) {
console.log(err);
}
if (err && err.code === 'NotFound') {
// Handle no object on cloud here
console.log('file doesnt exist');
return cb('Manifest file was not found.', null);
} else {
console.log('file exists');
console.log(metadata);
let file = require('fs').createWriteStream(downloadLocation);
s3.getObject(params).
on('httpData', function(chunk) {
file.write(chunk);
}).
on('httpDone', function() {
file.end();
console.log('website manifest downloaded for processing...');
return cb(null, 'success');
}).
send();
}
});
};