This is a Python library to read and write BSA (archive) files for Skyrim Special Edition.
See here for more information about the BSA file specification: https://en.uesp.net/wiki/Skyrim_Mod:Archive_File_Format
Run pip install sse-bsa to install the library and its dependencies in the current active environment.
>>> archive = BSAArchive(Path("my_archive.bsa"))>>> archive.files
["interface/translations/test.txt", "textures/test/test.png"]>>> archive.glob("interface/translations/*.txt")
["interface/translations/test.txt"](this maintains its folder structure)
>>> archive.extract_file("interface/translations/test.txt", Path("output"))For eg. the extracted file would be located at output/interface/translations/test.txt.
(this also maintains the archive's folder structure)
>>> archive.extract(Path("output"))The entire archive folder structure would be extracted to output.
>>> archive.get_file_stream("interface/translations/test.txt").read()
b'This is a test'>>> BSAArchive.create_archive(Path("input"), Path("new_archive.bsa"))The entire folder structure of input gets maintained when packing in the new_archive.bsa.