Skip to content

Instantly share code, notes, and snippets.

@andijakl
Created October 8, 2018 16:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andijakl/1f0676dd29a035b18d04df904a29df89 to your computer and use it in GitHub Desktop.
Save andijakl/1f0676dd29a035b18d04df904a29df89 to your computer and use it in GitHub Desktop.
HTTPS requests using Node.js and async / await through the request-promise-native module
const rp = require("request-promise-native");
async function processData() {
try {
let response = await rp("https://www.andreasjakl.com/");
if (response.length > 100) {
let response2 = await rp("https://www.andreasjakl.com/wp-content/uploads/2018/08/arcore-anchors.gif");
console.log("Data: ", response2.substring(0,10));
}
} catch (error) {
console.log("Error: ", error);
}
}
processData();
console.log("Starting...");
@karthikkoruvada09
Copy link

while trying to install that module....is is saying no such module exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment