An open API service indexing awesome lists of open source software.

https://github.com/bahaaio/base64-cli

A minimal and efficient Base64 encoder/decoder CLI tool written in C++.
https://github.com/bahaaio/base64-cli

base64 cli cpp decoding encoding lightweight utility

Last synced: 10 months ago
JSON representation

A minimal and efficient Base64 encoder/decoder CLI tool written in C++.

Awesome Lists containing this project

README

          

# ๐Ÿงฌ base64-cli

A minimal and efficient Base64 encoder/decoder written in C++.
Supports file input/output, piped stdin, and argument input.

> ๐Ÿ”ง No dependencies. Cross-platform. Fast. Ideal for quick scripts or lightweight CLI usage.

## โœจ Features

- ๐Ÿ“ Encode or decode Base64
- ๐Ÿ“‚ Input from file, argument, or `stdin`
- ๐Ÿ“ค Output to file or `stdout`
- ๐Ÿšซ Graceful error handling
- ๐Ÿงช Useful for piping, scripting, and quick testing

## ๐Ÿ“‹ Examples

### ๐Ÿ”ค Encode a string

```bash
./base64 "hello"
# โ†’ aGVsbG8=
```

### ๐Ÿ“ Encode a file

```bash
./base64 -i hello.txt
```

### ๐Ÿงช Pipe input via stdin

```bash
echo -n "hello" | ./base64
```

### ๐Ÿ”“ Decode from file to binary output

```bash
./base64 -d -i encoded.txt -o image.png
```

### โ” Show help

```bash
./base64 --help
```

## ๐Ÿ› ๏ธ Build

### Using CMake

```bash
cmake -B build
cd build
cmake --build .
./base64 "hello"
```

### Or manually

```bash
g++ -std=c++17 -O2 -o base64 ./src/main.cpp
```

## ๐Ÿ“ฆ Usage

```bash
base64 [options] [input...]
```

### Options

| Option | Description |
| ---------------- | ---------------------- |
| `-e`, `--encode` | Encode input (default) |
| `-d`, `--decode` | Decode input |
| `-i ` | Read input from file |
| `-o ` | Write output to file |
| `-h`, `--help` | Show help message |

## ๐Ÿ” License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.