# rbase64
A fast multi-threaded base64 encoding / decoding library and CLI tool, made in Rust.
[![Crates.io](https://img.shields.io/crates/v/rbase64?style=flat-square)](https://crates.io/crates/rbase64)
[![Crates.io](https://img.shields.io/crates/d/rbase64?style=flat-square)](https://crates.io/crates/rbase64)
[![Build Status](https://img.shields.io/github/workflow/status/uhmarcel/rbase64/CI/main?style=flat-square)](https://github.com/uhmarcel/rbase64/actions/workflows/ci.yml?query=branch%3Amain)
[![Coverage Status](https://coveralls.io/repos/github/uhmarcel/rbase64/badge.svg?branch=main)](https://coveralls.io/github/uhmarcel/rbase64?branch=main)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](LICENSE-APACHE)
[![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](LICENSE-MIT)
---
Have you ever wanted to base64 encode tens of gigabytes of data, but felt your encoder was not fast enough? Me neither.
Either way,
rbase64 is up to the task.
The goal of rbase64 is to provide a fast implementation of base64 encoding. The library is thoroughly tested and optimized
for high throughput. As of v2.0.3, rbase64 is able to achieve up to 11.133 GiB/s encoding and 14.251 GiB/s decoding rates (measured
in MacBook Air M1 2020 laptop, 10~20 MiB batches).
The project also comes with a command line interface powered by the library encoder. While limited by I/O,
it still achieves high performance compared to other alternatives (for example, GNU base64 by a factor of 11x).
For details, see [Performance](#performance).
# Usage
## Library
Add rbase64 to your Cargo.toml dependencies:
```toml
[dependencies]
rbase64 = "2.0.3"
```
**Sample usage:**
```rust
use rbase64;
fn main() {
let a = b"Hello world";
let b = "SGVsbG8gd29ybGQ=";
assert_eq!(rbase64::encode(a), b);
assert_eq!(&rbase64::decode(b).unwrap(), a);
}
```
## CLI
**Installation:**
```sh
$ cargo install rbase64 --features cli
```
**Usage**: rbase64 [OPTIONS]
Options | Description
---------------------------- | ----------------------------
**-d, --decode** | Decode input (default: false)
**-i, --input \** | Input file (stdin if missing)
**-o, --output \