Letting the user download a zip file in next js

So I have a function called handleDownload in a next js 14 app router component, which handles the downloads of reports. I send a parameter to the API and get a link to a google apis bucket where the pdf lies. How can I consolidate all these links into pdf’s and zip it so I can serve the user with one downloadable item.

  const handleDownload = async () => {
    setIsLoading(true);
    const newIds = selectedSampleIds.filter(id => !downloadableLinks.some(link => link.id === id));
    
    const newLinks = [];
    const notAvailable = [];

    for (const id of newIds) {
      try {
        const data = await fetchPdf(id);
        newLinks.push({ id, data });
      } catch (error) {
        notAvailable.push(id);
      }
    }

    setDownloadableLinks(prevLinks => [...prevLinks, ...newLinks]);

    // Attempt to download all available PDFs
    const allLinks = [...downloadableLinks, ...newLinks];
    selectedSampleIds.forEach((sampleId) => {
      const downloadableLink = allLinks.find((link) => link.id === sampleId);
      if (downloadableLink) {
        window.open(downloadableLink.data.url, '_blank');
      }
    });

    setIsLoading(false);
    return { newLinks, notAvailable };
  };

I am currently just opening these links so the user can directly download it from there. How can I consolidate these into a zip file. I have tried jszip and also using a server component but I have had no luck.