ContentsIndex
LFile Class Members
LFile Class | Legend
Members
Methods
Method 
Description 
Queries if there are still data to be read (if it reaches the end of file or not). 
Closes the file to release resource to prevent leakage. Makes sure the data are completely written to the SD/flash storage. 
Makes sure the data are written into SD/flash storage to prevent data corruption in case of unexpected power outage or cut. 
Folder is a special type of file. isDirectory() is used to identify if an LFile object is a file or a folder. 
name 
Returns the name of file. 
Folder is a special type of file. openNextFile() is used for enumerating sub-files in a folder. It returns the next sub-file or sub-folder from the folder. 
peek 
Reads single byte from file without moving the file cursor. If peek() is called repeatedly, it will always get the same result because the cursor is kept in the same place. In contrast, read() moves the file cursor 1 step further. 
Returns the position of file cursor.
  • Use read() to retrieve content from the current position and move the cursor at the same time.
  • Use peek() to retrieve content from the current position without moving the cursor.
  • Use seek() to change the cursor position.
 
read 
Reads single byte from the file and moves the file cursor 1 step further. In contrast, peek() reads from the file without moving the file cursor. 
read 
Reads the array of bytes from file. 
Folder is a special type of file. rewindDirectory() is used with openNextFile() to rewind the enumeration and start from the beginning; so that the next openNextFile() call will return the first sub-file (or sub-folder). 
seek 
Changes the cursor position; it can be from 0 to the size of file.
  • Use read() to retrieve the content on the current position and move the cursor at the same time.
  • Use peek() to retrieve content on the current position without moving the cursor.
  • Use position() to get the current cursor position.
 
size 
Returns the size of file. 
Writes data information to the file opened with FILE_WRITE mode, which is similar to print().