Whats the best way to read a remote file? I want to get the whole file (not chunks).
I started with the following example
var get = http.get(options)
function(url,callback){ request(url).on('data',(data) => { try{ var json = JSON.parse(data); } catch(error){ callback(""); } callback(json); }) }
You can also use this. This is to async flow. The error comes when the response is not a JSON. Also in 404 status code .