lib/utils.js
function getXpiInfo(xpiPath) {
  return extractXPI(xpiPath)
    .then(function(tmpXPI) {
      var getInfo;
      var packageFile = path.join(tmpXPI.path, "package.json");
      var installRdfFile = path.join(tmpXPI.path, "install.rdf");

      if (fileExists(packageFile)) {
        getInfo = getXpiInfoFromManifest(require(packageFile));
      } else if (fileExists(installRdfFile)) {
        getInfo = nodefn.call(fs.readFile, installRdfFile)
          .then(function(data) {
            return getXpiInfoFromInstallRdf(data);
          });
      } else {
        getInfo = when.reject(
          new Error("Cannot get info: no manifest found in this XPI"));
      }

      return getInfo
        .catch(function(err) {
          try {
            tmpXPI.remove();
          } catch (e) {} // eslint-disable-line no-empty
          throw err;
        })
        .then(function(info) {
          tmpXPI.remove();
          return info;
        });
    });
}
function getXpiInfo(xpiPath) {
  return extractXPI(xpiPath)
    .then(function(tmpXPI) {
      var getInfo;
      var packageFile = path.join(tmpXPI.path, "package.json");
      var installRdfFile = path.join(tmpXPI.path, "install.rdf");

      if (fileExists(packageFile)) {
        getInfo = getXpiInfoFromManifest(require(packageFile));
      } else if (fileExists(installRdfFile)) {
        getInfo = nodefn.call(fs.readFile, installRdfFile)
          .then(function(data) {
            return getXpiInfoFromInstallRdf(data);
          });
      } else {
        getInfo = when.reject(
          new Error("Cannot get info: no manifest found in this XPI"));
      }

      return getInfo
        .catch(function(err) {
          try {
            tmpXPI.remove();
          } catch (e) {} // eslint-disable-line no-empty
          throw err;
        })
        .then(function(info) {
          tmpXPI.remove();
          return info;
        });
    });
}
function getXpiInfo ( xpiPath ) { return extractXPI ( xpiPath ) . then ( function ( tmpXPI ) { var getInfo ; var packageFile = path . join ( tmpXPI . path , "package.json" ) ; var installRdfFile = path . join ( tmpXPI . path , "install.rdf" ) ; if ( fileExists ( packageFile ) ) { getInfo = getXpiInfoFromManifest ( require ( packageFile ) ) ; } else if ( fileExists ( installRdfFile ) ) { getInfo = nodefn . call ( fs . readFile , installRdfFile ) . then ( function ( data ) { return getXpiInfoFromInstallRdf ( data ) ; } ) ; } else { getInfo = when . reject ( new Error ( "Cannot get info: no manifest found in this XPI" ) ) ; } return getInfo . catch ( function ( err ) { try { tmpXPI . remove ( ) ; } catch ( e ) { } // eslint-disable-line no-empty throw err ; } ) . then ( function ( info ) { tmpXPI . remove ( ) ; return info ; } ) ; } ) ; }
Returns a promise that resolves with an info object about an XPI file.

@param {String} xpiPath - path to the XPI file
@return {Object} xpiInfo
- manifest: manifest object, which might be empty.
- id: GUID of the XPI.
- version: version string for the XPI.
Returns a promise that resolves with an info object about an XPI file .