Skip to content

jonathanong/s3-set-headers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Update headers on all objects in a bucket

Resources

License

Stars

Watchers

Forks

Packages