FATFS is a middleware component you can add to create a MicroSD API with full file I/O support. It only takes a few clicks with CubeMX and you have an API with the following and more:
- f_mount(): Register/Unregister a work area
- f_open(): Open/Create a file
- f_close(): Close a file
- f_read(): Read a file
- f_write(): Write a file
- f_lseek(): Move read/write pointer, Expand a file size
- f_truncate(): Truncate a file size
- f_sync(): Flush cached data
- f_opendir(): Open a directory
- f_readdir(): Read a directory item
- f_getfree(): Get free clusters
- f_stat(): Check if the object is exist and get status
- f_mkdir(): Create a directory
- f_unlink(): Remove a file or directory
- f_chmod(): Change an attribute
- f_utime(): Change timestamp
- f_rename(): Rename/Move a file or directory
- f_chdir(): Change the current directory
- f_chdrive(): Change the current drive
- f_getcwd(): Retrieve the current directory
- f_getlabel(): Get volume label
- f_setlabel(): Set volume label
- f_forward(): Forward file data to the stream directly
- f_mkfs(): Create a file system on the drive
- f_fdisk(): Devide a physical drive
- f_gets(): Read a string
- f_putc(): Write a character
- f_puts(): Write a string
- f_printf(): Write a formatted string
- f_tell(): Get the current read/write pointer
- f_eof(): Test for end-of-file on a file
- f_size(): Get the size of a file
- f_error(): Test for an error on a file
- disk_initialize(): Initializes the physical disk drive
- disk_status(): Returns the selected physical drive status
- disk_read(): Reads sector(s) from the disk
- disk_write(): Writes sector(s) to the disk
- disk_ioctl(): Controls device-specified features
- get_fattime(): Returns the current time