Thanks... I'll try and update the docs. Basically:
function(res)
on('data')
on('close')
The HTTP image loader example does this:
require("http").get("http://www.espruino.com/images/espruino_84_48_1bpp.bmp", function(res) { var bmpString = ""; res.on('data', function(data) { bmpString += data; }); res.on('close', function() { var img = require("BMPLoader").load(bmpString); // ... }); });
@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.
Thanks... I'll try and update the docs. Basically:
function(res)
is called when the connection is establishedon('data')
is called when there's a chunk of data (this almost certainly will be more than once)on('close')
is called when the connection closes.The HTTP image loader example does this: