Skip to content

Instantly share code, notes, and snippets.

@maxgfr
Last active December 2, 2022 22:18
Show Gist options
  • Save maxgfr/448baca2d72beeb449ce6b1a93b01894 to your computer and use it in GitHub Desktop.
Save maxgfr/448baca2d72beeb449ce6b1a93b01894 to your computer and use it in GitHub Desktop.
Copy HTML page in local with nodejs
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