Closed piranha771 closed 2 years ago
FS is not supported for any board, but ESP32 and ESP8266 using native SPIFFS or LIttleFS.
This won't be worked on and supported in the near future.
I would it find more intuitive if the readme.md would contain a hint that this library only supports sending http content in form of strings and not streams (except ESP controllers). Thank you for your work nonetheless.
EDIT: I found it noteworthy to attach a work around for sending files:
File file = SD.open(curi);
server.send(200, getContentType(uri), "");
server.setContentLength(file.size());
char cBuf[4096];
uint32_t lenSend = 0;
EthernetClient cl = server.client();
while (file.available())
{
uint32_t len = file.read(cBuf, 4096);
cl.writeFully(cBuf, len);
lenSend += len;
}
file.close();
Describe the bug
I try to send a html (actually a whole SPA) from an SD card over ethernet. But streaming files is not working.
Steps to Reproduce
SD.begin(BUILTIN_SDCARD);
in setup()At any point in request handler function insert:
Expected behavior
The
myFile
is send to the clientActual behavior
The debug check files size output shows correct size of file to send. The browser fails with
net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
Reported: File is incomplete (Actually no file is written. I doubt that bytes are sent at all)Debug and AT-command log (if applicable)