Skip to main content

Read and write not only bytes in python (like DataStream in java)

Project description

datastream

Read and write binary files by integer, floats, strings with fixed size.

Installing

pip install python-datastream

Usage

Reading:

from datastream import DataInputStream

with open("test.bin", "rb") as f:
    ds = DataInputStream(f)
    print(ds.read_int())
    print(ds.read_strz())

Writing:

from datastream import DataOutputStream

with open("test.bin", "wb") as f:
    ds = DataOutputStream(f)
    ds.write_int(42)
    ds.write_strz("Hello world")

License

MIT License. See LICENSE file.

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

python-datastream-0.1.0.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

python_datastream-0.1.0-py3-none-any.whl (7.9 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