node package manager



Dependency Status

Extends the Knox Node Amazon S3 client to support copying and listing arbitrarily large buckets. Transparently streams keys and copies files from buckets that exceed Amazon's 1000 key page size limit.


npm install knox-copy


Stream the keys of all the files in a bucket:

knoxCopy = require 'knox-copy'
client = knoxCopy.createClient
  key: '<api-key-here>'
  secret: '<secret-here>'
  bucket: 'mrbucket'
client.streamKeys(prefix: 'buckets/of/fun')
.on 'data'(key) -> console.log key

Backup a bucket full of uploads:

knoxCopy = require 'knox-copy'
client = knoxCopy.createClient
  key: '<api-key-here>'
  secret: '<secret-here>'
  bucket: 'backups'
  fromBucket: 'uploads'
  fromPrefix: '/nom-nom'
  toPrefix: "/upload_backups/#{new Date().toISOString()}"
  (err, count) ->
     console.log "Copied #{count} files"

Running Tests

Setup tests as with knox. You must first have an S3 account, and create a file named ./auth, which contains your credentials as json, for example:


Then install the dev dependencies and execute the test suite:

$ npm install
$ npm test