requirements are as follows:
- the front end selects a file name to pass parameters to node
- first download the data to the Java backend through the post request (plus token) and save it to node (at this time, the file format is zip)
- send the downloaded file to the front end from node, and download the front end
questions are as follows:
now that you have implemented 1 and 2, when you try to implement 3, refer to the". / public/ resource name configured in the parameter download in res.dowload (),. The suffix "does not quite understand who this relative path is. Although the download resource of a tag is simulated in the reference example, it is still too clear about the logic. Please do not hesitate to give us advice on orz
.the code is as follows:
var express = require("express");
router.get("/xxx", function(req, res){
res.download("public/xx.xx");
});
the third requirement is to realize that the front-end chrome can call up its own downloader to download files locally to client. It is best to achieve one-step real-time download through pipe, instead of completing the transfer and then starting the front-end download. Mainly do not understand how to achieve this step through download
there may be some problems with the expression. Please take care of orz.