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.1.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.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: raff-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 347bc45f6cc8918d05123dc235a711aa8612a3b13b0a58b99bb6bdfe152842e2
MD5 b49ecc599082eadb65dfa69a862253c4
BLAKE2b-256 77f03316ad1eb6f13a1e45082b1a60638cefbeede736aa1c7081eb8e8d562194

See more details on using hashes here.

File details

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

File metadata

  • Download URL: raff-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 07c0a92794574063bc73e61045f68f9c6e3b0ba272957edfeddbbfdc4dd3ddd9
MD5 adb3daf54e65e52037d9040ca5f7eaf0
BLAKE2b-256 909754d91fb51a9195fba3e723caaa27f1c4f1318bd66beb97a0c912fa33d730

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