client-zip: TypeError: Failed to fetch // Question

Hello! I am using client-zip to package up audio tracks (probably ~75-100 at a time) in my NextJS app. The first few times I ran this, it was excitingly performant considering my input. However, after those initial test attempts I am now getting TypeError: Failed to fetch. Is there a better way to handle this based on my use case? I just copy pasta’d the example usage code so I very well could be missing something that would help me out here.

Thank you!

const createZip = async (tracks) => {
  console.log("started");
  let files: any = [];
  tracks.map((track) => {
    track.clips.forEach((clip) => {
      files.push({ name: `${track.name}/${clip.name}`, input: clip.content });
    });
  });
  try {
    // get the ZIP stream in a Blob
    const blob = await downloadZip(files).blob();

    // make and click a temporary link to download the Blob
    const link = document.createElement("a");
    link.href = URL.createObjectURL(blob);
    link.download = "MultiTracks.zip";
    link.click();
    link.remove();
    console.log("finished");
  } catch (err) {
    console.log(err);
  }
};

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 26 (9 by maintainers)

Most upvoted comments

Thanks. I am relieved to see an explanation and it’s not even a bug in client-zip.

With any luck, @hwyatt and @freedomsky11 will find similar problems in their code or bundler…