Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

543
Views
downloading application/zip file with javascript (with file-saver)

I am trying to download a zipfile that my webapp receives my backend in javascript. I am using the file-saver library, just because I use it in another part of the app, but I would also be ok, doing it with vanilla js (creating a blob, attaching it to hidden a element...). I tried out all I could find on the web about it, but it still doesn't work. The file is downloaded, but it cannot be opened, my archive manager just says there is an error... However, I know that the file coming from the server is ok. When test the endpoint of the api, that delivers the file, in swagger I can download and open the file normally.

if (response.headers["content-type"] === "application/zip") {
  const filename = response.headers['Content-Disposition'].match(/filename="(.+)"/)[1]
  FileSaver.saveAs(new Blob([response.data], {type: "application/zip"}), filename)
}

If anyone has any tip, on how I could go about debugging this, I would be very thankful :)

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!