lib/syncmanager.js
function(callback) {
    var packageToVersions = this.packageToVersions;
    var count = Package.versionCount(packageToVersions);
    if (count === 0) {
      return callback && callback();
    }

    var packages = Object.keys(packageToVersions);
    async.parallel(
      packages
        .map(function(package) {
          var versions = Object.keys(packageToVersions[package]);
          return versions.map(function(version) {
            return this.downloadPackageVersion.bind(this, package, version);
          }.bind(this));
        }.bind(this))
        .reduce(function(prev, curr) {
          return prev.concat(curr);
        }),
      function(err) {
        return callback && callback(err);
      }
    );
  }
function(callback) {
    var packageToVersions = this.packageToVersions;
    var count = Package.versionCount(packageToVersions);
    if (count === 0) {
      return callback && callback();
    }

    var packages = Object.keys(packageToVersions);
    async.parallel(
      packages
        .map(function(package) {
          var versions = Object.keys(packageToVersions[package]);
          return versions.map(function(version) {
            return this.downloadPackageVersion.bind(this, package, version);
          }.bind(this));
        }.bind(this))
        .reduce(function(prev, curr) {
          return prev.concat(curr);
        }),
      function(err) {
        return callback && callback(err);
      }
    );
  }
function ( callback ) { var packageToVersions = this . packageToVersions ; var count = Package . versionCount ( packageToVersions ) ; if ( count === 0 ) { return callback && callback ( ) ; } var packages = Object . keys ( packageToVersions ) ; async . parallel ( packages . map ( function ( package ) { var versions = Object . keys ( packageToVersions [ package ] ) ; return versions . map ( function ( version ) { return this . downloadPackageVersion . bind ( this , package , version ) ; } . bind ( this ) ) ; } . bind ( this ) ) . reduce ( function ( prev , curr ) { return prev . concat ( curr ) ; } ) , function ( err ) { return callback && callback ( err ) ; } ) ; }
Download a package version object and tarball for each package version.

@param {Function} callback invoke when done.
Download a package version object and tarball for each package version .