s3-set-headers
v1.0.1
Published
Update headers on all objects in a bucket
Downloads
12
Maintainers
Readme
s3-set-headers
Iterate through a bucket, checking whether headers need updating, and updating them when necessary.
API
const Update = require('s3-set-headers')
Update({
// s3 bucket information passed to `knox`
secret: '',
key: '',
bucket: '',
// s3 listing options passed to s3lister
prefix: '',
// maximum number of objects to update concurrently
concurrency: 5,
// whether the headers need updating
test(key, headers) {
return !headers['cache-control']
},
// new headers to set
update(key, headers) {
return {
'cache-control': 'public, max-age=3600',
'x-amz-acl': 'public-read',
}
}
})