https://github.com/matthewandretaylor/lil_buff_writer
Writing utility for storing and retrieving messages
https://github.com/matthewandretaylor/lil_buff_writer
buffers messages python
Last synced: 7 months ago
JSON representation
Writing utility for storing and retrieving messages
- Host: GitHub
- URL: https://github.com/matthewandretaylor/lil_buff_writer
- Owner: MatthewAndreTaylor
- License: apache-2.0
- Created: 2025-03-02T06:18:29.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-02T06:37:55.000Z (7 months ago)
- Last Synced: 2025-03-02T06:46:45.391Z (7 months ago)
- Topics: buffers, messages, python
- Language: Python
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lil_buff_writer
A simple writing utility for storing and retrieving messages.
Messages are formated as such ``
This archive format aims to be light weight and easy to use.Instead of writing out many files, you can pack them into one file.
Writing out a stream of messages to a single blob allows you to write to a single destination instead of searching for files later.## Features
- Write messages to a file with labeled names and content.
- Parse each of the messages from a stream.## Installation
```sh
pip install lil_buff_writer
```## Usage
### Writing Messages
Using Python
```python
from lil_buff_writer import write_messagesmessages = [(b"greeting", b"Hello, World!"), (b"farewell", b"Goodbye!")]
await write_messages(messages, "messages.dat")
```Using the Command Line
```bash
python -m lil_buff_writer test.bin --encode file0.txt file1.md ...
```### Reading Messages
Using Python
```python
from lil_buff_writer import read_messageswith open("messages.dat", "rb") as f:
for name, content in read_messages(f):
print(f"{name.decode()}: {content.decode()}")
```Using the Command Line
```bash
python -m lil_buff_writer test.bin --decode [output_dir]
```## License
Apache-2.0