read#
- barecat.Barecat.read(item, offset=0, size=-1)[source]#
Read a file from the archive, starting from an offset and reading a specific number of bytes.
- Parameters:
item (Union[BarecatFileInfo, str]) – Either a BarecatFileInfo object, or a path to a file within the archive.
offset (int) – Offset within the file to start reading from.
size (int) – Number of bytes to read. If -1, read until the end of the file.
- Returns:
The contents of the file, as bytes.
- Raises:
ValueError – If the CRC32C checksum of the read data does not match the expected value.
FileNotFoundBarecatError – If a file with this path does not exist in the archive.
- Return type: