Just to add the fix for what you want is just the second example here: https://www.espruino.com/Internet#client
require("http").get("http://www.espruino.com", function(res) { var contents = ""; res.on('data', function(data) { contents += data; }); res.on('close', function() { console.log(contents); }); });
basically get all the data, then parse in one go when the socket is closed
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Just to add the fix for what you want is just the second example here: https://www.espruino.com/Internet#client
basically get all the data, then parse in one go when the socket is closed