How to make the client download a very large file that is genereted on the fly

后端 未结 4 1607
伪装坚强ぢ
伪装坚强ぢ 2021-02-02 04:05

I have an export function that read the entire database and create a .xls file with all the records. Then the file is sent to the client.

Of course, the time of export t

4条回答
  •  猫巷女王i
    2021-02-02 04:13

    You do not have to send the whole file once, you can send this file by chunks (line by line for example), just use res.write(chunk) and res.end() at finish to mark it as completed.

提交回复
热议问题