Utility for keeping directories in sync with Rackspace Cloud Files
$ npm install cloudfiles-mirror -g
Usage: cloudfiles-mirror [options] Options: -h, --help output usage information -V, --version output the version number -c, --config [value] Configuration file -l --local [value] Local directory to mirror -r --remote [value] Remote container -b --base [value] Remote base directory -u --user [value] Rackspace username -k --key [value] Rackspace API key --cdn Enable CDN support when creating the container -m --monitor Enable monitor the local directory -s --servicenet Enable ServiceNet (unmetered, double throughput) Only within Rackpace servers -w --workers <n> Number of symultaneous parallel workers interacting with the Cloud Servers API --show_config Show current configuration and exits --sync_all Pushes all local files on the first run.
Require the module
var CloudfilesMirror = ;
Create a mirror instance
var mirror =;
Once a cloudfiles-mirror instance is created, you can listen for these events:
// You will probably want to wait for this event// before interacting with the remote Cloud Files accountmirror;mirror;// When received remote filesmirror;// Triggered whenever a remote file is addedmirror;// Triggered whenever a remote file is removedmirror;// Triggered when scanning the directory when options.pushOnBoot is truemirror;// File watcher eventsmirror;mirror;mirror;
Pushes all the files on .localPath to the remote cloud
Starts monitoring the .localPath and mirroring changes on the Cloud container
You can define new mime types with
All of the cloudservers-mirror tests are written in vows, and cover all of the use cases described above. You will need to add your Rackspace API username and API key to test/fixtures/test-config.json before running tests:
"auth":"username": "your-username""apiKey": "your-apikey"
Once you have valid Rackspace credentials you can run tests with vows:
vows test/*-test.js --spec