01 Going further: read EPUB metadata with JSZip

On /files, JSZip is loaded before your plugin. To compare real titles instead of file names:

  async function epubTitle(path) {
    const buf = await (await fetch('/download?path=' + encodeURIComponent(path))).arrayBuffer();
    const zip = await JSZip.loadAsync(buf);
    const container = await zip.file('META-INF/container.xml').async('string');
    const opfPath = container.match(/full-path="([^"]+)"/)[1];
    const opf = await zip.file(opfPath).async('string');
    return (opf.match(/<dc:title[^>]*>([^<]*)</) || [])[1] || null;
  }

This downloads the whole book into the browser, so it's slow over the reader's Wi-Fi. Use it on demand for a few files, not for a 500-book scan.
Reader file (.txt)