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.3.tar.gz (8.7 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.3-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for raff-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4c92debb2f0334658ac3944c9b68ef46400ca737627b671b776d5cf1effdbf49
MD5 bc951c2646a7e7e4e6c69369f455dad7
BLAKE2b-256 3411f347771cc7f584fa9db92b23d37eb7b0c405bd80bb4e6d3f3a354ba5ab0e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for raff-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 039748af0eb5f77ee2683ebf44a92ffc3cbb867c54d49e83b4a0ddc70af32322
MD5 f0371173c85cc67c739f33c15d6de5f0
BLAKE2b-256 1f4779130cecdaeac74e8f228751a50dfbc34d7c8590b6e52707bad5cb389b29

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