class documentation

Class to read and access an ERF archive (MOD, HAK, ERF, ...)

Example

>>> with open("Prelude.mod", "rb") as file:
...    erf = Reader(file)
...    print(erf.filenames)
...    gff_data = erf.read_file("item.uti")
...    ...
Parameters
fileThe file object to read from.
Class Entry Undocumented
Class Version Undocumented
Method __init__ Undocumented
Method read_file Retrieve the contents of a file from the archive.
Property build_date The build date of the ERF archive.
Property description_strref The STRREF set in the ERF header. 0 if not set.
Property file_type The file type of the ERF archive.
Property filemap Returns the mapping of files.
Property filenames Returns the filenames in the ERF archive.
Property localized_strings The localized strings in the ERF archive.
Class _Header Undocumented
Method _seek Undocumented
Instance Variable _file Undocumented
Instance Variable _files Undocumented
Instance Variable _header Undocumented
Instance Variable _localized_strings Undocumented
Instance Variable _root_offset Undocumented
def __init__(self, file, max_entries=65535, max_locstr=100): (source)

Undocumented

def read_file(self, filename: str) -> bytes: (source)

Retrieve the contents of a file from the archive.

Parameters
filename:strThe name of the file to retrieve.
Returns
bytesThe contents of the file as a byte string.
Raises
KeyErrorIf the file is not found in the archive.
ValueErrorIf the filename is of a unknown restype.
@property
build_date: date = (source)

The build date of the ERF archive.

@property
description_strref: int = (source)

The STRREF set in the ERF header. 0 if not set.

@property
file_type: FileMagic = (source)

The file type of the ERF archive.

@property
filemap: dict[str, Entry] = (source)

Returns the mapping of files.

This method returns the internal dictionary that maps file names to their corresponding file data.

Returns
A dict mapping file names to their corresponding Entry objects.
@property
filenames: list[str] = (source)

Returns the filenames in the ERF archive.

Returns
A list of filenames present in the ERF archive.
@property
localized_strings: dict[GenderedLanguage, str] = (source)

The localized strings in the ERF archive.

def _seek(self, relative_to_start): (source)

Undocumented

Undocumented

Undocumented

Undocumented

_localized_strings = (source)

Undocumented

_root_offset = (source)

Undocumented