The library serves static files from the filesystem and, optionally, includes a web editor (ACE) to manage files directly from the browser.
By default, files are served from the filesystem with:
- root URL
/-> filesystem path/ - default file:
index.htm
In code (internally):
serveStatic("/", fs, "/").setDefaultFile("index.htm")
server.printFileList(FILESYSTEM, "/", 1); // default -> Serial
server.printFileList(FILESYSTEM, "/", 1, Serial); // or to a chosen streamThe Print& overload is useful to log to streams other than Serial.
server.enableFsCodeEditor();Main endpoints:
GET /editeditor pageGET /list?dir=/directory listingPOST /edituploadPUT /editcreate/renameDELETE /editdelete
On ESP32, to show correct “total/used bytes” in the UI:
server.setFsInfoCallback([](fsInfo_t* fsInfo) {
fsInfo->fsName = "LittleFS";
fsInfo->totalBytes = LittleFS.totalBytes();
fsInfo->usedBytes = LittleFS.usedBytes();
});