Skip to content

Instantly share code, notes, and snippets.

@robertoostenveld
Last active January 8, 2017 10:07
Show Gist options
  • Save robertoostenveld/5a7e9eb0877cd06d6930a419234dbf0a to your computer and use it in GitHub Desktop.
Save robertoostenveld/5a7e9eb0877cd06d6930a419234dbf0a to your computer and use it in GitHub Desktop.
ESP8266WebServer handler that returns SPIFFS directory list
// 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