1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

add folder api for SPIFFS

This commit is contained in:
ficeto
2015-05-16 02:29:26 +03:00
parent 7179c1aea8
commit 1cd9cd312f
3 changed files with 95 additions and 43 deletions

View File

@ -76,6 +76,20 @@ public:
void sendHeader(String name, String value, bool first = false);
void sendContent(String content);
template<typename T> size_t streamFile(T &file, String contentType){
String head = "HTTP/1.1 200 OK\r\nContent-Type: ";
head += contentType;
head += "\r\nContent-Length: ";
head += file.size();
head += "\r\nConnection: close";
head += "\r\nAccess-Control-Allow-Origin: *";
head += "\r\n\r\n";
_currentClient.print(head);
head = String();
return _currentClient.write(file, HTTP_DOWNLOAD_UNIT_SIZE);
}
protected:
void _handleRequest();
bool _parseRequest(WiFiClient& client);