ESP32 web project: Save data on file

Hi everyone,
I'm developing a simple web page on the esp32 to control an arduino due module.
I'm using javascript to implement the dynamic aspects of the page, but i haven't found a way to use js to create and save a file that work on the esp32.

Can someone help me with this problem?
(Sorry for my bad english)

You want to use javascript to run on an ESP32, is that correct?

Also, what is the flavor of your ESP32?

Yes, I’m using javascript to make a dynamic web page to control arduino.
The esp module is ESP32-WROVER.
I’ve already make some javascript functions that work fine, but i can’t find a method to generate a text file and save it.

Oi! I did not know that a ESP32-WROVER can run java script.

Are you running Espruino?

I made files on the ESP32 using SPIFF's.

I’ve found a solution just now. It seems to work on the esp32

function saveToFile(){ 
          var xhttp =  new XMLHttpRequest();
          xhttp.onreadystatechange = function(){
            if(this.readyState == 4 && this.status == 200){
              var res = this.responseText.split("/");
              var s = "";
              for (var i = 0; i < res.length; i++){
                s = s + res[i] + "," + "\n";
              var blob = new Blob([s], { type: "plain/text"});
              function download(blob,name) {
                var url = URL.createObjectURL(blob),
                div = document.createElement("div"),
                anch = document.createElement("a");
                anch.innerHTML = "&nbsp;";
       = "0";
       = "0";
                anch.href = url;
       = name;
                var ev = new MouseEvent("click",{});
          }"GET", "measure", true);