To get the file size one has to open the file and call f.size(). That works. But if opening the file also creates it, the size is wrong.
File f = SPIFFS.open("/test.txt", "a"); // this creates the file if it does not exist. Opens for appending data.
size_t sz = f.size();
f.size() works if the file already exists when opening it. But if the first line of code has to create the file, the size comes out wrong.
Peter
SPIFFS file.size() wrong on newly created file
Who is online
Users browsing this forum: No registered users and 43 guests