code: function install(extension, dir) {
    return getDetails(extension).then(function(details) {
      function returnId() { return details.id; }
  
      var dst = path.join(dir, details.id);
      if (extension.slice(-4) === '.xpi') {
        if (!details.unpack) {
          return io.copy(extension, dst + '.xpi').then(returnId);
        } else {
          return checkedCall(fs.readFile, extension).then(function(buff) {
            var zip = new AdmZip(buff);
            // TODO: find an async library for inflating a zip archive.
            new AdmZip(buff).extractAllTo(dst, true);
          }).then(returnId);
        }
      } else {
        return io.copyDir(extension, dst).then(returnId);
      }
    });
  }
docs: Installs an extension to the given directory.
  @param {string} extension Path to the extension to install, as either a xpi
  file or a directory.
  @param {string} dir Path to the directory to install the extension in.
  @return {!promise.Promise.<string>} A promise for the add-on ID once
  installed.