Download large file with node.js avoiding high memory consumption

后端 未结 6 928
梦毁少年i
梦毁少年i 2020-12-12 15:35

I`m trying to create a file downloader as a background service but when a large file is scheduled, it\'s first put in memory and then, at the end of the download the file is

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-12 15:38

    does the request package work for your uses?

    it lets you do things like this:

    request(downloadurl).pipe(fs.createWriteStream(downloadtohere))
    

提交回复
热议问题