Download multiple files as a folder in JS [duplicate]

In JS, I have the following function to download one file from a URL:

export async function downloadFile(url: string, filename: string) {
  const res = await fetch(url);
  const blob = await res.blob();
  const blobUrl = window.URL.createObjectURL(blob);

  const a = document.createElement('a');
  a.style['display'] = 'none';
  a.href = blobUrl;
  a.download = `${filename}.pdf`;

  window.document.body.appendChild(a);
  a.click();
  window.document.body.removeChild(a);
}

I can reuse this function to download an array of files but I’d like them to download all at once inside a folder.

The browser downloads this folder which would contain all my files. How do I do that?