A simple Python library for encoding and decoding bytes
Project description
Byte Codec
A simple Python Library for encoding and decoding various data types to and from bytes.
Installation
pip install byte-codec
Usage
from byte_codec import ByteCodec
codec = ByteCodec()
# Encoding
int_bytes = codec.encode_from_int(12345)
string_bytes = codec.encode_from_string("Hello, World!")
float_bytes = codec.encode_from_float(3.14159)
list_bytes = codec.encode_from_list([b'\x01\x02', b'\x03\x04'])
# Decoding
int_value = codec.decode_to_int(int_bytes)
string_value = codec.decode_to_string(string_bytes)
float_value = codec.decode_to_float(float_bytes)
list_value = codec.decode_to_list(list_bytes, 2)
# Generic encoding
any_bytes = codec.encode_from_any(12345) # Works with int, str, float, list, or bytes
License
This Project is licensed under the MIT License - see the LICENSE file for details.
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
byte_codec-0.1.4.tar.gz
(3.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file byte_codec-0.1.4.tar.gz.
File metadata
- Download URL: byte_codec-0.1.4.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b693458484f6cee969ea6ab305275d4e116ce4439236cd6edf81c189cddcd68a
|
|
| MD5 |
f07d29ca0a9c3be3dbcd3e938b154ff9
|
|
| BLAKE2b-256 |
0e7afda19a2db91b9221a20c110864ec8e53133e14f5e4c24454a3ac9fb1d781
|
File details
Details for the file byte_codec-0.1.4-py3-none-any.whl.
File metadata
- Download URL: byte_codec-0.1.4-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e53f4ac09e27000a375ce03e6fd880361f1d351fda7d55a1ed3fd7c8683e7385
|
|
| MD5 |
ca2032cef81a3933bcbe0d355f9649f0
|
|
| BLAKE2b-256 |
6f68c3659a5e323764ce66787ee7aa51a3c39ed8fd56d5e66ca4afe1e5d7e674
|