code: function readManifest(addonPath) {
    var manifest;
  
    if (addonPath.slice(-4) === '.xpi') {
      manifest = checkedCall(fs.readFile, addonPath).then(function(buff) {
        var zip = new AdmZip(buff);
        if (!zip.getEntry('install.rdf')) {
          throw new AddonFormatError(
              'Could not find install.rdf in ' + addonPath);
        }
        var done = promise.defer();
        zip.readAsTextAsync('install.rdf', done.fulfill);
        return done.promise;
      });
    } else {
      manifest = checkedCall(fs.stat, addonPath).then(function(stats) {
        if (!stats.isDirectory()) {
          throw Error(
              'Add-on path is niether a xpi nor a directory: ' + addonPath);
        }
        return checkedCall(fs.readFile, path.join(addonPath, 'install.rdf'));
      });
    }
  
    return manifest.then(function(content) {
      return checkedCall(xml.parseString, content);
    });
  }
docs: Reads the manifest for a Firefox add-on.
  @param {string} addonPath Path to a Firefox add-on as a xpi or an extension.
  @return {!promise.Promise.<!Object>} A promise for the parsed manifest.