FileSystem.h File Reference
#include <spiffs_sming.h>
#include <WVector.h>
#include <WString.h>
Include dependency graph for FileSystem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef signed short file_t
 File handle. More...
 

Enumerations

enum  FileOpenFlags {
  eFO_ReadOnly = SPIFFS_RDONLY, eFO_WriteOnly = SPIFFS_WRONLY, eFO_ReadWrite = eFO_ReadOnly | eFO_WriteOnly, eFO_CreateIfNotExist = SPIFFS_CREAT,
  eFO_Append = SPIFFS_APPEND, eFO_Truncate = SPIFFS_TRUNC, eFO_CreateNewAlways = eFO_CreateIfNotExist | eFO_Truncate
}
 File open flags. More...
 
enum  SeekOriginFlags { eSO_FileStart = SPIFFS_SEEK_SET, eSO_CurrentPos = SPIFFS_SEEK_CUR, eSO_FileEnd = SPIFFS_SEEK_END }
 File seek flags. More...
 

Functions

static FileOpenFlags operator| (FileOpenFlags lhs, FileOpenFlags rhs)
 
file_t fileOpen (const String &name, FileOpenFlags flags)
 Open file. More...
 
void fileClose (file_t file)
 Clode file. More...
 
int fileWrite (file_t file, const void *data, size_t size)
 Write to file. More...
 
int fileRead (file_t file, void *data, size_t size)
 Read from file. More...
 
int fileSeek (file_t file, int offset, SeekOriginFlags origin)
 Position file cursor. More...
 
bool fileIsEOF (file_t file)
 Check if at end of file. More...
 
int32_t fileTell (file_t file)
 Get position in file. More...
 
int fileFlush (file_t file)
 Flush pending writes. More...
 
int fileLastError (file_t fd)
 Get last file system error code. More...
 
void fileClearLastError (file_t fd)
 Clear last file system error. More...
 
int fileSetContent (const String &fileName, const char *content, int length=-1)
 Create or replace file with defined content. More...
 
int fileSetContent (const String &fileName, const String &content)
 Create or replace file with defined content. More...
 
uint32_t fileGetSize (const String &fileName)
 Get size of file. More...
 
int fileTruncate (file_t file, size_t newSize)
 Truncate (reduce) the size of an open file. More...
 
int fileTruncate (file_t file)
 Truncate an open file at the current cursor position. More...
 
int fileTruncate (const String &fileName, size_t newSize)
 Truncate (reduce) the size of a file. More...
 
int fileRename (const String &oldName, const String &newName)
 Rename file. More...
 
Vector< StringfileList ()
 Get list of files on file system. More...
 
String fileGetContent (const String &fileName)
 Read content of a file. More...
 
size_t fileGetContent (const String &fileName, char *buffer, size_t bufSize)
 Read content of a file. More...
 
int fileStats (const String &name, spiffs_stat *stat)
 
int fileStats (file_t file, spiffs_stat *stat)
 
int fileDelete (const String &name)
 Delete file. More...
 
int fileDelete (file_t file)
 Delete file. More...
 
bool fileExist (const String &name)
 Check if a file exists on file system. More...