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 | |
No class docstring; 1/1 property, 0/1 class variable, 1/1 method documented |
| Class | |
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 |
The file magic for NWSync manifest files. |
| Constant | NWSYNC |
The only supported version of the NWSync manifest file format. |
Reads and parses a manifest file from a binary stream.
| Parameters | |
file:BinaryIO | A binary stream representing the manifest file. |
| Returns | |
Manifest | An object representing the parsed manifest. |
| Raises | |
ValueError | If the file does not contain a valid manifest. |
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:BinaryIO | A binary stream to write the manifest to. |
manifest:Manifest | The manifest to write to the stream. |
| Raises | |
ValueError | If the manifest is invalid. |