Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.
/ knox-copy Public archive

Extends the Knox Node Amazon S3 client to support copying and listing buckets

Notifications You must be signed in to change notification settings

goodeggs/knox-copy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

knox-copy

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.

Install

npm install knox-copy

Examples

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'

client.copyBucket
  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:

{
  "key":"<api-key-here>",
  "secret":"<secret-here>",
  "bucket":"<your-bucket-name>"
}

Then install the dev dependencies and execute the test suite:

$ npm install
$ npm test

About

Extends the Knox Node Amazon S3 client to support copying and listing buckets

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •