Skip to main content

bitio

Utilities to read or write files by bit or bits

How to use

from bitio import bit_open

f = bit_open(file_name, "r")
x = f.read()           # return 1 or 0
x = f.read_bits(count) # return int

f = bit_open(file_name, "w")
f.write(bit)              # write 1 if bit else 0
f.write_bits(bits, count) # write 'count bits'
f.close()

These are the same

f.write_bits(bits, count)

for i in range(count-1, -1, -1):
  if bits & (1 << i):
    f.write(1)
  else:
    f.write(0)

Another interface

l = []
wrapper = ByteWrapper(l.append)
f = bit_wrap(wrapper, "w")
f.write_bits(0b110000101, 10)
print(l)    # [b"a"]
f.close()
print(l)    # [b"a", b"@"]

Metadata

Release files for bitio 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitio 0.3.0
File Size Uploaded Provenance Actions
bitio-0.3.0.tar.gz 2.6 kB Without provenance Details for bitio-0.3.0.tar.gz

Release files / bitio-0.3.0.tar.gz

Download URL bitio-0.3.0.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
75e36e0ea1bef150213d8d8f01d55e45562181ef2d6febc9e56d4f52d9d40a9f
BLAKE2b-256 checksum
How to use checksums
1d27e6c59bc77c5445e07d749bf9d17ca0e055852bb6c0d8fbaeebaf32d25840
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for bitio 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page