Metadata-Version: 2.4
Name: safelz4
Version: 0.0.1.dev0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: System :: Archiving :: Compression
Classifier: Typing :: Typed
Requires-Dist: black==22.3 ; extra == 'quality'
Requires-Dist: click==8.0.4 ; extra == 'quality'
Requires-Dist: isort>=5.5.4 ; extra == 'quality'
Requires-Dist: flake8>=3.8.3 ; extra == 'quality'
Requires-Dist: setuptools-rust>=1.5.2 ; extra == 'testing'
Requires-Dist: pytest>=7.2.0 ; extra == 'testing'
Requires-Dist: pytest-benchmark>=4.0.0 ; extra == 'testing'
Requires-Dist: hypothesis>=6.70.2 ; extra == 'testing'
Requires-Dist: atheris>=2.3.0 ; extra == 'testing'
Requires-Dist: xxhash ; extra == 'testing'
Provides-Extra: quality
Provides-Extra: testing
License-File: LICENCE.md
Summary: safe LZ4 data compress library.
Author-email: Luca Vivona <lucavivona01@gmail.com>
Requires-Python: >=3.8
Description-Content-Type: text/markdown


<p align="center">
  <picture>
    <img alt="safelz4" src="https://raw.githubusercontent.com/LVivona/safelz4/refs/heads/main/.github/assets/banner.png" style="max-width: 100%;">
  </picture>
</p>

<p align="center">
    <a href="https://github.com/LVivona/safelz4/blob/main/LICENCE.md"><img alt="GitHub" src="https://img.shields.io/badge/licence-MIT Licence-blue"></a>
    <!-- Uncomment when release to pypi -->
    <a href="https://pypi.org/project/safelz4/"><img alt="PyPI" src="https://img.shields.io/pypi/v/safelz4"></a>
    <a href="https://pypi.org/project/safelz4/"><img alt="Python Version" src="https://img.shields.io/pypi/pyversions/safelz4?logo=python"></a>
</p>

Rust binding into python of the lz4 library [lz4_flex](https://github.com/PSeitz/lz4_flex) The Fastest LZ4 implementation in Rust.


## Installation

### Pip

You can install `safelz4` via the pip manager:

```python
pip install safelz4
```

### From source

For the sources, you need Rust

```bash
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Make sure it's up to date and using stable channel
rustup update
git clone https://github.com/LVivona/safelz4
cd safelz4
pip install setuptools_rust
# install
pip install -e .
```

## Getting Started


### Frame Format
```python
from safelz4 import compress_file, open_frame

buffer = None
with open("dickens.txt", "r") as file:
    buffer = file.read(-1).encode("utf-8")

compress_file("dickens.lz4", buffer)

output = None
with open_frame("dickens.lz4") as f:
   output = f.decompress()

```

### Block Format
```python
from safelz4.block import compress_prepend_size, 

buffer = None
with open("dickens.txt", "r") as file:
    input_b = file.read(-1).encode("utf-8")
    buffer = compress_prepend_size(input_b)

output = decompress_size_prepended(buffer)
```

### Overview

