Last active
January 8, 2017 10:07
-
-
Save robertoostenveld/5a7e9eb0877cd06d6930a419234dbf0a to your computer and use it in GitHub Desktop.
ESP8266WebServer handler that returns SPIFFS directory list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server.on("/dir", HTTP_GET, handleDirList); | |
void handleDirList() { | |
SPIFFS.begin(); | |
String str = ""; | |
Dir dir = SPIFFS.openDir("/"); | |
while (dir.next()) { | |
str += dir.fileName(); | |
str += " "; | |
str += dir.fileSize(); | |
str += " bytes\r\n"; | |
} | |
server.send(200, "text/plain", str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment