b64/README.md
2023-08-30 22:50:50 +02:00

56 lines
No EOL
1,018 B
Markdown

# b64
A tool I created to
* Base64 encode/decode text quickly from [helix](https://helix-editor.com/) :)
* Learn a bit of Zig
## Usage
```
Usage: b64 [-e] [-d] <string>
-h, --help
Display this help and exit.
-d, --decode
Decode base64 to string.
-e, --encode
Encode string to base64.
-v, --version
Display version.
<str>
String to encode or decode.
```
### Encoding
```shell
$ b64 -e "encode this string to base64"
ZW5jb2RlIHRoaXMgc3RyaW5nIHRvIGJhc2U2NA==
# From stdin
$ echo -n "encode this string to base64" | b64 -e
ZW5jb2RlIHRoaXMgc3RyaW5nIHRvIGJhc2U2NA==
$
```
### Decoding
```shell
$ b64 -d ZW5jb2RlIHRoaXMgc3RyaW5nIHRvIGJhc2U2NA==
encode this string to base64
# From stdin
$ echo -n "ZW5jb2RlIHRoaXMgc3RyaW5nIHRvIGJhc2U2NA==" | b64 -d
encode this string to base64
$
```
## Build
```shell
$ git clone https://git.kcbark.net/zig/b64.git && cd b64
$ zig build -Doptimize=ReleaseFast
$ cp zig-out/bin/b64 ~/.local/bin
```