Use result of HTTPS GET request [Node.js] [duplicate]
问题 This question already has answers here : How do I return the response from an asynchronous call? (42 answers) Closed 2 years ago . I'm stuck with a small problem I think, but I can't find a way to solve it. I want to load a remote JSON in a variable, using Node.js HTTPS GET request. It's a success, but I can't use it anywhere else in my code. My function is the following (from Node.js doc): function getMyFile() { var https = require('https'); https.get('URL_I_am_targeting/file.json', (res) =>