You are reading a single comment by @user47006 and its replies. Click here to read the full conversation.
  • Hello,
    I have a pico with an ESP8226 working and trying to move some code that I currently have from a node.js project but it seems that res.on('end') does not work in espruino.
    In order to fix it, I have to change the event from 'end' to 'close'.

    I also tried changing my nodejs app to use 'close' but It does not work there, I know it's an easy change but I was tying to have the code compatible with node.js and espruino.

    Is there a way to add the event 'end' in the http response in espruino?

    Code not working in espruino pico

    	var contents = "";
            require('http').get("http://www.pur3.co.­uk/hello.txt", function(res) {
                res.on('data', function(data) {
                    contents += data;
                });
                res.on('end', function() {
                    console.log(contents);
                });
            });
    

    thx

About

Avatar for user47006 @user47006 started