Command line interface for advanced base 64 encoding/decoding
npm install base64-advanced-cli

```
$ npm install --global base64-advanced-cli
... or just try it without installing it :
``
$ npx base64-advanced-cli -e "Hello World!"
... or try the Online Demo 💪
This CLI provides the following command : b64
`8b ,d8" 88
88 ad8888ba, ,d8
88 8P' "Y8 ,d888
88 d8 ,d8" 88
88,dPPYba, 88,dd888bb, ,d8" 88
88P' "8a 88P'
88 d8 88 d8 8888888888888
88b, ,a8" 88a a8P 88
8Y"Ybbd8"' "Y88888P" 88
base64-advanced-client v1.x.x
Usage: b64 [options]
Options:
-d, --decode [data] set mode to encoding
-e, --encode [data] set mode to decoding
--web-safe use websafe substitution characters when encoding/decoding
-i, --input-file
-o, --output-file
-v, --version display the version of this CLI
--jwt display the content of a jwt token
--html encode an image into an html tag containing base64 data
--no-update-notification do not display update notifications
-h, --help display help for command
``
#### Encoding :
``
$ b64 -e "Hello World!"SGVsbG8gV29ybGQh
Will return value.
The --web-safe argument will replace + by -, / by _ and remove the trailing equal signs (= or ==)
#### Decoding :
``
$ b64 -d SGVsbG8gV29ybGQhHello World!
Will return value.
#### Writing output to a file :
``
$ b64 -d SGVsbG8gV29ybGQh -o decoded.txt
Will create a file named decoded.txt containingext " Hello world! " text, instead of displaying the output in the console.
#### Reading input from a file :
``
$ b64 -e -i decoded.txt
Will read file contents and encodode it, rather than using the command input.
#### Stdin usage
You can also read input from stdin _(only on unix systems)_ to encode & decode data
``
$ echo "Hello World!" | b64 -eSGVsbG8gV29ybGQhCg==
will return .
stdin is also applicable for decoding purposes
``
$ echo SGVsbG8gV29ybGQhCg== | b64 -dHello World!
will return .`
#### JWT Preview :
This CLI provides a simple way to preview the content of JWT tokens.`
$ b64 --jwt eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjJ9.hqWGSaFpvbrXkOWc6lrnffhNWR19W_S1YKFBx2arWBk`
will return the following output :`
Header : {
"alg": "HS256",
"typ": "JWT"
}
Body : {
"name": "John Doe",
"iat": 1516239022
}
:warning: The CLI does NOT validate the signature of the token since this is not the purose of this tool.
#### HTML Image base 64 encoding :
You can use this CLI to directly encode your images as html base64 images (with automatic mime type dectection).
``
$ b64 -e --html -i image.png
Will return the html tag containing the encoded image in base 64 format (e.g. ).```
$ b64 -e --html -i image.png -o image.html
Will perform the same operation but will save the image html content in a file rather than simply displaying the output.
Any improvement ideas are welcome, feel free to create issues for evolutions/bugs on the repository of the project.