1.0.4 • Published 8 years ago

gcloud-sync-ew v1.0.4

Weekly downloads
5
License
ISC
Repository
github
Last release
8 years ago

Google Cloud Storage synchronisation utility

Installation

$ npm install --save gcloud-sync-ew

Configuration

const gsync = require('gcloud-sync-ew');

// customizing options up-front
const gsync = require('gcloud-sync-ew')({ parallelLimit: 2 });

// making an instance available to other files
const gsync = require('gcloud-sync-ew');
gsync.custom = gsync({ parallelLimit: 2 });
// freeing memory: delete gsync.custom

// ES5: injecting Promise dependency
var Promise = require('my-promise-lib');
var gsync = require('gcloud-sync-ew')({ Promise: Promise });

Synchronizing store data

gsync.execute({

  // MANDATORY FIELDS and example values

  projectId: 'uniqueProjectId',
  keyFilename: __dirname + '/key.json',
  bucket: 'pubsite_prod_rev_<developer-id>',
  prefix: 'stats/installs/installs_',
  outputDirectory: __dirname + '/sync-bucket',

  // OPTIONAL FIELDS and example values

  nameSelector: function(name) {
    return name.indexOf('2016') > -1;
  },

}).then(() => console.log('Done.'))
.catch(console.error);

Running tests

$ npm install --only=dev
$ npm install mocha // or npm install -g mocha
$ npm test