27 lines
853 B
C++
27 lines
853 B
C++
#ifndef FileHandler_h
|
|
#define FileHandler_h
|
|
|
|
#include <Arduino.h> // Inclure Arduino.h pour utiliser String
|
|
#include <FS.h> // Inclure la bibliothèque FS (ou la bibliothèque appropriée)
|
|
|
|
struct FileInfo {
|
|
String name;
|
|
size_t size;
|
|
};
|
|
|
|
class FileHandler {
|
|
public:
|
|
FileHandler();
|
|
FileInfo* listDir(fs::FS &fs, const char *dirname, uint8_t levels, int &fileCount);
|
|
void freeFileInfo(FileInfo* fileInfo);
|
|
bool createDir(fs::FS &fs, const char *path);
|
|
bool removeDir(fs::FS &fs, const char *path);
|
|
bool readFile(fs::FS &fs, const char *path);
|
|
bool writeFile(fs::FS &fs, const char *path, const char *message);
|
|
bool appendFile(fs::FS &fs, const char *path, const char *message);
|
|
bool renameFile(fs::FS &fs, const char *path1, const char *path2);
|
|
bool deleteFile(fs::FS &fs, const char *path);
|
|
};
|
|
|
|
#endif
|