FatIO¶
Implementation of FatIO for basic I/O.
- class pyfatfs.FatIO.FatIO(fs: PyFat, path: str, mode: fs.mode.Mode = fs.mode.Mode)¶
Bases:
RawIOBase
Wrap basic I/O operations for PyFat.
Wrap basic I/O operations for PyFat. Currently read-only.
- Parameters:
fs – PyFat: Instance of opened filesystem
path – str: Path to file. If mode is r, the file must exist.
mode – Mode: Mode to open file in.
- close() None ¶
Close open file handles assuming lock handle.
- read(size: int = -1) bytes | None ¶
Read given bytes from file.
- readable() bool ¶
Determine whether the file is readable.
- readinto(_FatIO__buffer: bytearray) int | None ¶
Read data “directly” into bytearray.
- seek(offset: int, whence: int = 0) int ¶
Seek to a given offset in the file.
- Parameters:
offset –
int
: offset in bytes in the filewhence –
int
: offset position: -0
: absolute -1
: relative to current position -2
: relative to file end
- Returns:
New position in bytes in the file
- seekable() bool ¶
FAT I/O driver is able to seek in files.
- Returns:
True
- truncate(size: int | None = 0) int ¶
Truncate file to given size.
- Parameters:
size – int: Size to truncate to, defaults to 0.
- Returns:
int: Truncated size
- writable() bool ¶
Determine whether the file is writable.
- write(_FatIO__b: bytes | bytearray) int | None ¶
Write given bytes to file.