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(data);});
req.on("close",function(){
f.close();
res.end();
});
}
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.
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
Doing same without piping works fine