Readma? What's Readma?
Project description
Readma? What's Readma?
Readma is a binary stream reading library I made for fun that I decided I would extend on and release
Well, what does it do?
Well I'm glad you asked!
Readma is a little library I started to help with parsing binary files.
That's it?
Well yeah, what did you expect? Some large module I've been writing my entire life that will change the world with its amazing binary reading ability?
Cool Badges
Usage
Note, requires Python 3.8 or higher (For now at least)
Installation
pip install readma
Sample code
from readma import Readma
# Let's say this file contains in order:
# - An integer
# - An unsigned integer
# - A float
# - A string prefixed by its length with a byte
# - An unknown amount of data you just really need read
r = Readma("some_file.bin") # note: defaults to Little Endian
integer = r.read(4) # size in bytes
unsigned_integer = r.uread(4)
a_float = r.float()
length = r.read(1)
string = r.bytes(length)
important_data = r.readall()
Example of ways to do the same action
from readma import Readma, ReadmaTypes
r = Readma(b"AAAABBBBCCCCDDDD")
A = r.read(4) # Reads a 32 bit (4 byte) integer
B = r.read("int") # this also reads a 32 bit int
C = r.read(ReadmaTypes.int) # someone might prefer this idk
D = r.bytes(4) # its a bytestring, do whatever with it
You can also move around the buffer using seek, skip, and tell
from readma import Readma
r = Readma(b"AAAABBCCCCXXXXXXXXDDDD")
A = r.read(4)
r.seek(6) # seek past B
C = r.read(4)
r.skip(8) # skip past the next 8 bytes
D = r.read(4)
Oh and you can check the size of the buffer too
from readma import Readma
r = Readma(b"AAAABBBBCCCCDDDD")
assert r.size() == 16
# observe the script not halting
Documentation
tba
License
Copyright (c) 2021 whamer100
This project is MIT licensed.
hey is this project name just one big ligma joke
maybe
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file readma-1.0.3a0.tar.gz.
File metadata
- Download URL: readma-1.0.3a0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ac1916803c678c6054a0034fad677f1b1ccf82beb4498bacfe6bed8a9cd9c9
|
|
| MD5 |
822dc8014b24a8788721b6d1b465e8f5
|
|
| BLAKE2b-256 |
f6d5329f1c60aa8f23d2d77f8b5dbf663faa5a8afa672c3f1a8418bfa3701c4f
|