I am trying download a zip file from nodejs using vuejs.
My problem is that I have a weird underscore around the fileName when the dialog appears.
If I set manually:
const fileName="xmlFile.zip"; I have no problem.
I attached an image of the problem.
Here is the headers returnning from node:
Accept-Ranges: bytes Access-Control-Allow-Origin: * Access-Control-Expose-Headers: Content-Disposition Cache-Control: public, max-age=0 Connection: keep-alive Content-Disposition: attachment; filename="xmlFile.zip" Content-Length: 164 Content-Type: application/zip Date: Sun, 19 Jul 2020 13:55:15 GMT ETag: W/"a4-17367574de4" Last-Modified: Sun, 19 Jul 2020 13:50:41 GMT X-Powered-By: Express What am I doing wrong?
//vuejs front end let response = await axios.post('/generateLoteXMLZIPConsulta');; let blob = await new Blob([response.data], { type: "application/zip", }); const link = document.createElement("a"); link.style.display = "none"; link.href = window.URL.createObjectURL(blob); const fileName = response.headers["content-disposition"].match( /filename=(.*)/ )[1]; link.download = fileName; link.click(); window.URL.revokeObjectURL(link.href); //backend nodejs router.post("/generateLoteXMLZIPConsulta", async (req, res) => { .... .... res.download( path.resolve(__dirname, "../../file.zip"), "xmlFile.zip" ); }) 
"Content-Disposition": "attachment;filename=your-file-name.zip". This way we'll figure out, on what side the problem is - node or vue.