1.0.1 • Published 9 years ago

s3-set-headers v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

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