How can I replicate the functionality of a wget with node.js?

后端 未结 5 1839
我寻月下人不归
我寻月下人不归 2021-02-02 17:01

Is it possible to essentially run a wget from within a node.js app? I\'d like to have a script that crawls a site, and downloads a specific file, but the href

5条回答
  •  余生分开走
    2021-02-02 17:22

    For future reference though, I would recommend request, which makes it this easy to fetch that file:

    var request = require("request");
    
    request(url, function(err, res, body) {
      // Do funky stuff with body
    });
    

提交回复
热议问题