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

    // For each package version, check shasum and copy to server root.
    var packages = Object.keys(packageToVersions);
    async.parallel(
      packages
        .map(function(package) {
          var versions = Object.keys(packageToVersions[package]);
          return versions.map(function(version) {
            return this.verifyPackageVersion.bind(this, package, version);
          }.bind(this));
        }.bind(this))
        .reduce(function(prev, curr) {
          return prev.concat(curr);
        }),
      function(err) {
        if (err) {
          return callback && callback(err);
        }

        ncp(this.tempdir, this.root, callback);
      }.bind(this)
    );
  }
function(callback) {
    var packageToVersions = this.packageToVersions;
    var count = Package.versionCount(packageToVersions);
    if (count === 0) {
      return callback && callback();
    }

    // For each package version, check shasum and copy to server root.
    var packages = Object.keys(packageToVersions);
    async.parallel(
      packages
        .map(function(package) {
          var versions = Object.keys(packageToVersions[package]);
          return versions.map(function(version) {
            return this.verifyPackageVersion.bind(this, package, version);
          }.bind(this));
        }.bind(this))
        .reduce(function(prev, curr) {
          return prev.concat(curr);
        }),
      function(err) {
        if (err) {
          return callback && callback(err);
        }

        ncp(this.tempdir, this.root, callback);
      }.bind(this)
    );
  }
function ( callback ) { var packageToVersions = this . packageToVersions ; var count = Package . versionCount ( packageToVersions ) ; if ( count === 0 ) { return callback && callback ( ) ; } // For each package version, check shasum and copy to server root. var packages = Object . keys ( packageToVersions ) ; async . parallel ( packages . map ( function ( package ) { var versions = Object . keys ( packageToVersions [ package ] ) ; return versions . map ( function ( version ) { return this . verifyPackageVersion . bind ( this , package , version ) ; } . bind ( this ) ) ; } . bind ( this ) ) . reduce ( function ( prev , curr ) { return prev . concat ( curr ) ; } ) , function ( err ) { if ( err ) { return callback && callback ( err ) ; } ncp ( this . tempdir , this . root , callback ) ; } . bind ( this ) ) ; }
Check the shasums of all of the downloaded packages and then
copy the downloaded data to our server root if there are no issues.

@param {Function} callback invoke when done.
Check the shasums of all of the downloaded packages and then copy the downloaded data to our server root if there are no issues .