feat(base64-rs): add GNU-compatible base64 command for Windows

Windows has no base64 command; certutil is file-only, adds PEM markers
and cannot be piped. This is a real base64.exe matching GNU coreutils:
same flags (-d, -i, -w), stdin/stdout streaming, exit codes and error
messages, so existing muscle memory and scripts carry over.

Verified against coreutils 9.7 with a 153-case differential test. The
subtle behaviours are reproduced: bytes are emitted incrementally so a
stream that goes bad still writes its valid prefix, unpadded tails are
accepted only when canonically encoded, concatenated streams decode as
one, and -w0 suppresses the trailing newline.

Deliberate deviation: '\r' is skipped when decoding alongside '\n', as
CRLF base64 files are routine on Windows and GNU rejects them.

Zero dependencies, so the build works offline.
This commit is contained in:
2026-07-27 21:36:01 +01:00
parent 3ee7d7a3ac
commit 5e6b4428bb
6 changed files with 556 additions and 0 deletions
+10
View File
@@ -12,6 +12,16 @@ A single-file web tool that decodes a base64 string and saves it back out as a r
xdg-open base64-decoder/base64-decoder.html
```
### [base64 for Windows](./base64-rs/)
A real `base64.exe` for Windows, which otherwise has no `base64` command — only `certutil`, which is file-only, adds PEM markers and can't be piped. Matches GNU coreutils flag for flag (`-d`, `-i`, `-w`, stdin/stdout, exit codes, error messages), verified against coreutils 9.7 with a 153-case differential test. Zero dependencies, single static binary, streams its input.
```powershell
cargo build --release # then put target\release\base64.exe on your PATH
base64 image.png > image.b64
base64 -d image.b64 > image.png
```
### [Fake Media](./fake-media/)
Generates large collections of placeholder PNG images for testing without downloading real files. Supports a terminal UI and a non-interactive CLI mode. Configurable image sizes, folder structure, file counts, and naming prefixes — uses only Python's standard library.