s3-set-headers

1.0.1 • Public • Published

s3-set-headers

NPM version Build status Test coverage Dependency Status License Downloads

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',
    }
  }
})

Package Sidebar

Install

npm i s3-set-headers

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • jongleberry