I'm trying to get ESP8266 to download a bunch of files from a server and to save them to SPIFFS, but I'm having a hard time making it happen.
I can get a file from a server and load it to a string variable using this:
String url = "http://domain.com/file.whatever";
HTTPClient http;
http.begin(url);
String payload = http.getString();
http.end();
and then i can save the string to a file using something like that:
void stringToFile(String fileName, String text) {
File f = SPIFFS.open(fileName, "w");
f.write((uint8_t *)text.c_str(), text.length());
f.close();
}
It works just fine with small text files, but it crashes with larger files.
Can someone help me with this one?