What is the best way to download a big file in NodeJS?

前端 未结 3 2006
梦如初夏
梦如初夏 2021-02-15 08:09

The below server code is working fine for 5GB file using wget http://localhost:11146/base/bigFile.zip but not using client side code.

Serve

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-15 08:29

    var request = require('request')
    request('http:/localhost:11146/base/bigFile.zip', function (error, response, body) {
      console.log('error:', error); // Print the error if one occurred
      console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
      console.log('body:', body); // Print the HTML for the Google homepage.
    });
    

    It should be http://localhost:11146/base/bigFile.zip instead of http:/localhost:11146/base/bigFile.zip

提交回复
热议问题