It's because you're parsing the data into JSON as it arrives. In Node.js it's arriving in one big chunk but in Espruino it's a few smaller ones.
Do like it suggests here and do stuff on the close event, not the data one: http://www.espruino.com/Internet#client
close
data
require("http").get("http://www.espruino.com", function(res) { var contents = ""; res.on('data', function(data) { contents += data; }); res.on('close', function() { // do JSON.parse(contents) }); });
oh, thanks, Gordon, good support on your forum. Now my project is possible!!!
@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.
It's because you're parsing the data into JSON as it arrives. In Node.js it's arriving in one big chunk but in Espruino it's a few smaller ones.
Do like it suggests here and do stuff on the
close
event, not thedata
one: http://www.espruino.com/Internet#client