Last active
December 2, 2022 22:18
-
-
Save maxgfr/448baca2d72beeb449ce6b1a93b01894 to your computer and use it in GitHub Desktop.
Copy HTML page in local with nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const URL = "" | |
const rp = require('request-promise'); | |
const fs = require('fs'); | |
rp(URL).then(function(html){ | |
fs.writeFile("./res.html", html, function(err) { | |
if(err) { | |
return console.log(err); | |
} | |
console.log("The file was saved!"); | |
}); | |
}) | |
.catch(function(err){ | |
console.log(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment