Skip to main content

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

Tests

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

readma-1.0.2a0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

readma-1.0.2a0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file readma-1.0.2a0.tar.gz.

File metadata

  • Download URL: readma-1.0.2a0.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

Hashes for readma-1.0.2a0.tar.gz
Algorithm Hash digest
SHA256 d7bace6d4172249977d4de52ca2b32d826721c68ea656525965d98c92b59f7a3
MD5 53e64b5578befa3503ed21f78bdb4528
BLAKE2b-256 3c8871b67997d3475637950459594c4e4a9c0200d07f70b60f16078dcd06aef5

See more details on using hashes here.

File details

Details for the file readma-1.0.2a0-py3-none-any.whl.

File metadata

  • Download URL: readma-1.0.2a0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.5

File hashes

Hashes for readma-1.0.2a0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0ebd632f6ba38a3118de1286d81b392dcdfa30dbfa758f2623adef6e0490a5b
MD5 bb60905d5c97aba873ef57023caf3f42
BLAKE2b-256 93e9bad302af8ed8781502d01ffc2c734ca9a1ad5b9e6c97b0a13ce5a9eaec39

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