ESPAsyncWebServer: passing textfile to <textarea>

Hi team,

I'm using the ESPAsyncWebServer.h on the ESP8266 and I want to pass a log-file from LittleFS/SPIFFS to the user via the webserver into a html .

So I have a file called 'log.txt' which is stored on flash in the root directory. If the user calls the page I want to insert the File-content into the .

What I'm doing currently is, I use the String processor method. If the processor finds the %STRING% in the html page, I can replace the search strings with the target string. But this works only for small strings, as the string is stored in RAM.

This is an excerpt of my html-page

<textarea id="cmdtxt" name="cmdtxt" >%CMDTEXT%</textarea>

and this is the code excerpt of the file read:

String processor(const String& var){
  if (var == "CMDTEXT") {
    String content;
    File f = LittleFS.open("/log.txt", "r");
    
    while(f.available()){
        content += char(f.read());
    }
    f.close();
    return(content);
}

Now I want to server the textfile directly from the FS. How is this possible?

Thanks,
Alex