Skip to main content

Module for reading/writing chunk files.

Project description

Chunker

Description

Module for reading/writing chunk files.

Installation

pip install pychunker

Using

  • example.py:
import pychunker

with pychunker.open("chunkfile.bin", "w") as cf:
    # The chunk can be used via `with'.
    with cf.chunk("DDAT") as ddat:
        ddat.write(b'1234567890')
    
    # Or by contacting the key (name of the chunk).
    cf["SDAT"].write(b'Hello World!')

# !!! Attention !!!
# Both types of treatment use the same methods,
# namely that if you open a chunk file in read-only mode,
# and if the chunk is not in the chunk file,
# he will try to create a chunk,
# but he will not be able to do this and will give a `IONotWritableError`.

with pychunker.open("chunkfile.bin") as cf:
    print(cf.chunks)
  • Output:
[Chunk(name='DDAT', mode='r', size=10), Chunk(name='SDAT', mode='r', size=12)]

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

pychunker-1.4.1.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

pychunker-1.4.1-py3-none-any.whl (10.8 kB view hashes)

Uploaded Python 3

Supported by

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