Created
October 8, 2018 16:53
-
-
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
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 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..."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
while trying to install that module....is is saying no such module exists