Commit: 1d32c08
Parent: 2d40845

Add some documentation

Mårten Åsberg committed on 2025-11-08 at 09:21
README.md +69 -1
diff --git a/README.md b/README.md
index 34bb7e3..89f0fbc 100644
@@ -1,3 +1,71 @@
# ConvertBase64
A pair of PowerShell functions for converting to and from Base64 strings.
A pair of PowerShell cmdlets for converting to and from Base64 strings.
## Usage
The commands are simple and intuitive to use:
### Convert to Base64
The easiest way to convert to Base64 is to simply pipe a text string in to the command:
```pwsh
"Hello World!" | ConvertTo-Base64
```
That outputs the Base64 representation of the input test:
```
SGVsbG8gV29ybGQh
```
The byte encoding of the input text can be configured with the `-Encoding` parameter. The default encoding is UTF8.
The command can also be used to convert raw byte arrays to Base64 with:
```pwsh
ConvertTo-Base64 -Bytes @(0, 1, 2)
```
A convenient alias exists for the command:
```pwsh
"Hello World!" | ctb
```
### Convert from Base64
The `ConvertFrom-Base64` command works in a similar fashion, simply pipe a Base64 payload into it:
```pwsh
"SGVsbG8gV29ybGQh" | ConvertFrom-Base64
```
And it will output the decoded text:
```
Hello World!
```
This too features an `-Encoding` parameter for configuring the byte encoding when decoding the text output.
But it can also output raw byte arrays:
```pwsh
"AAEC" | ConvertFrom-Base64 -OutputBytes
```
Which will result in a byte array:
```
0
1
2
```
This too comes with a similarly named alias:
```pwsh
"SGVsbG8gV29ybGQh" | cfb
```