const http = require("http"); http.request({ host: "hostname", path: "/path/to/api" }, (response) => { let file = fs.createWriteStream('./file'); response.pipe(file); });