module documentation

Read/write nwsync manifests and associated helper utilities.

Binary File Format Version 3

These tables describe the binary file format for the NWSync manifest file itself.

For individual files, see nwn.compressedbuf.

Manifest

Field Type Description
uint32 version (always 3)
uint32 count of ManifestEntries
uint32 count of ManifestMappings
ManifestEntry[] count entries
ManifestMapping[] count additional mappings

ManifestEntry (sorted)

Field Type Description
byte[20] SHA1 (as raw bytes) of resref
uint32 size (bytes)
char[16] resref (WITHOUT extension, pad with 0-bytes)
uint16 restype

ManifestMapping (sorted)

Field Type Description
uint32 Index into ManifestEntry array
char[16] resref (WITHOUT extension, pad with 0-bytes)
uint16 restype
Class Manifest No class docstring; 1/1 property, 0/1 class variable, 1/1 method documented
Class ManifestEntry No class docstring; 1/1 property, 3/3 class variables documented
Function read Reads and parses a manifest file from a binary stream.
Function write Writes a manifest to a binary stream.
Constant NWSYNC_MANIFEST_MAGIC The file magic for NWSync manifest files.
Constant NWSYNC_MANIFEST_VERSION The only supported version of the NWSync manifest file format.
def read(file: BinaryIO) -> Manifest: (source)

Reads and parses a manifest file from a binary stream.

Parameters
file:BinaryIOA binary stream representing the manifest file.
Returns
ManifestAn object representing the parsed manifest.
Raises
ValueErrorIf the file does not contain a valid manifest.
def write(file: BinaryIO, manifest: Manifest): (source)

Writes a manifest to a binary stream.

Entries are always sorted by SHA1, then by resref, even if the passed-in manifest is not sorted. This ensures binary reproducibility.

Parameters
file:BinaryIOA binary stream to write the manifest to.
manifest:ManifestThe manifest to write to the stream.
Raises
ValueErrorIf the manifest is invalid.
NWSYNC_MANIFEST_MAGIC = (source)

The file magic for NWSync manifest files.

Value
FileMagic('NSYM')
NWSYNC_MANIFEST_VERSION: int = (source)

The only supported version of the NWSync manifest file format.

Value
3