Skip to main content

A library and utility for extensive parsing of IFF-based container formats.

Project description

raff is a Python library and command-line utility for extensive reading and parsing of IFF-based container formats.

#: Example usage:
from raff import Container

#: File-like objects, raw bytes, or file paths are all valid inputs.
file = "some_file.iff"

#: Initialize the container reader.
container = Container(file)

#: You can also ignore certain chunks from being read. 
#: This can be useful for improving performance in certain situations.
container = Container(file, ignore=["JUNK", "FLLR", "PAD ", "fake", "DGDA"])

#: Iterate over each chunk (excluding the master/header chunk):
for identifier, size, payload in container.get_chunks():
    #: Process each chunk (identifier, size, payload)
    ...

#: Access the master (header) chunk:
print(container.master)
#: Display the master chunk's size.
#: (For standard RIFF files, add 8 to this value to obtain the full file size,
#:  unless a .w64 file was provided.)
print(container.master["size"])
#: Display the form type (e.g., file type such as 'WAVE').
print(container.master["type"])
#: List all chunk identifiers encountered.
print(container.chunk_identifiers)

#: NOTE: Some chunk payloads may be very large. When printing, consider omitting the payload.

#: Retrieve data for a specific chunk (e.g., the 'fmt ' chunk).
print(container.chunk("fmt "))

#: Display the full container dictionary, which includes all chunks (excluding ignored ones)
#: along with the master header.
print(container.container)

TODO: Implement Chunk and add as many chunk parsers as possible.

from raff import Chunk
#: Initialize the chunk parser.
chunk = Chunk(file)

#: Iterate over each chunk (excluding the master/header chunk):
for identifier, size, payload in chunk.get_chunks():
    #: Chunk().get_chunks() would wrap over the Container() version 
    #: and return a parsed payload dict rather than the raw bytes.
    ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raff-0.1.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raff-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file raff-0.1.0.tar.gz.

File metadata

  • Download URL: raff-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for raff-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4c434cc7fa78797464dcac5a21906e320a8e7fed57ccca413004d0b24814976d
MD5 36bf043f3cc3f6aac998718351984ea8
BLAKE2b-256 1c31e37d5947d2ed7f57abc08807568f1bdc72149d1c033333aebb3b51ebb43a

See more details on using hashes here.

File details

Details for the file raff-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: raff-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for raff-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db33b5411ecd929d5d46bb66bc895ab541e85be48a263cbf3c87b0a9f08507c9
MD5 03ce7e7fa73371a7ee3a3a017a6310f7
BLAKE2b-256 1c065013dc4d6464e223eeab7158d8b79e2846162e85655e45593ec9a8351607

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page