copy files to S3

pushup - copy files to S3

The pushup Node module copies local files to an Amazon S3 bucket. It is designed to deploy file trees to S3 supporting gzip compression and the Cache-Control header.

pushup is a Transform stream to which you write filenames of files you want to copy to S3. If you export your S3 credentials to your process environment, you can neglect the options object.

var pushup = require('pushup')
var push = pushup()

Options let you control compression, caching, and the root of the path in the bucket.

function ttl () {
  return { 'file': 3600 * 24 * 30 }
function opts () {
  return {
    gzip: gzip()
  , ttl: ttl()
  , root: '/some'
var pushup = require('pushup')
var push = pushup(opts())

An optional bag of settings to toggle gzip compression by filename or extension as Boolean() (defaults to true). pushup compresses text files before they get uploaded using gzip and sets proper content/encoding headers. The following would compress all but xml:

{ '.xml': false }

Optional settings to configure Cache-Control headers by filename or extension in (max-age) delta-seconds. For example:

{ '.html': 3600 * 24 * 30, '.css': 3600 * 24 * 30, 'hot.html': 3600 }

With the root option you can control the root of the replicated file tree in your bucket. For example:

var pushup = require('pushup')
var push = pushup({root:'/some')

This would copy the files to /file and /other/file in your S3 bucket. If root is undefined or your defined root is not part of the given file path, the entire path will be replicated.

A configuration Object passed to the Transform stream constructor.

  • gzip gzip()
  • ttl ttl()
  • root root()
  • tmp String() defaults to '/tmp/pushup'
  • key String() defaults to process.env.AWS_ACCESS_KEY_ID
  • secret String() defaults to process.env.AWS_SECRET_ACCESS_KEY
  • bucket String() defaults to process.env.S3_BUCKET
  • region String() defaults to process.env.S3_REGION

A Transform stream that consumes filenames and emits paths of files copied to S3 using knox.

With npm do:

$ npm install pushup

MIT License