Avatar for JumJum

JumJum

Member since Oct 2013 • Last active Mar 2017
  • 77 conversations
  • 443 comments

Most recent activity

  • in JavaScript
    Avatar for JumJum

    Oh, hopefully, your kids will recognize that old man at the door ;-)
    Being serious now, what was strange in my code, which took away your time ?

    Thanks for your feedback. I will do as suggested.
    One thing I don't understand, there is an res.end in function uploadStd and another one in function uploadPipe. Are they never called, wrong location, or ??

    BTW, do you know about any guideline about setting up a VM for Espruino on Windows 10.

  • in JavaScript
    Avatar for JumJum

    Sorry, I don't have a linux build. My Ubuntu server is leased in the internet, and my laptop has windows.
    It's tested on ESP32, all my Espruino boards are without WiFi :-(

  • in JavaScript
    Avatar for JumJum

    Hopefully this helps (and there is no typo in text :-) ).

    First see attached files.

    • copy testPipe.html to sd
    • connect sd to your board
    • copy tesppipeJS.txt to webIDE
    • change ssid/passwd and pins to your board
    • send to your board
    • open nameOfServerOnYourBoard/testPipe.­html
    • fill textarea with a lot of chars, more than 1000
    • click Upload piped
    • check file on sd in webide console.log(require("fs").readFile("uplo­aded.html"). In my case only a few lines, up to 25, are found )
    • drop file on sd require("fs").unlink("uploaded.html")
    • click Upload eventdriven
    • do same check as before. In my case the file now holds everything

    BTW, looks like different sd cards result in different size for Upload piped

  • in JavaScript
    Avatar for JumJum

    Project is to support uploading of files and save on SD.
    It is tested on ESP32, I don't have hardware to compare with espruino board.
    If this is a ESP32 problem only, please move it to ESP32 forum.
    Doing the job with piping does not save full upload, some data at the end is missing

    function postUpload(req,res){
        var a = url.parse(req.url,true);  //there is a parameter given for location of new file on SD
        var f = E.openFile(a.query.pathname,"w");
        req.pipe(f,{chunkSize:32, end:false,
          complete:function(){
              f.close();
              res.end();
          }
        });
      }
    

    Doing same without piping works fine

    function postUpload(req,res){
        var a = url.parse(req.url,true);
        var f = E.openFile(a.query.pathname,"w");
        req.on("data",function(data){f.write(dat­a);});
        req.on("close",function(){
          f.close();
          res.end();
        });
      }
    
    • 4 comments
    • 92 views
  • in JavaScript
    Avatar for JumJum

    Wow, can't even write my questions as fast as your feedback is comin.
    Thanks a lot.

  • in JavaScript
    Avatar for JumJum

    I would like to write an array fo Float32Array to sd and read it back later.
    What is the best way to do this ?

  • in JavaScript
    Avatar for JumJum

    Brought the problem down the bottom.
    Don't know, what standard tells about this.
    If a port cannot be recognized, thats ok, but I would expect to get an error message.

    >var x = {port:C5};
    ={ "port": C5 }
    >var j = JSON.stringify(x);
    ="{\"port\":C5}"
    >var y = JSON.parse(j);
    =undefined
    
Actions