Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

commented Apr 8, 2019

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
You can’t perform that action at this time.