base64

v0.0.26
base64 [OPTION]... [FILE]

encode/decode data and print to standard output With no FILE, or when FILE is -, read standard input.

The data are encoded as described for the base64 alphabet in RFC 3548. When decoding, the input may contain newlines in addition to the bytes of the formal base64 alphabet. Use --ignore-garbage to attempt to recover from any other non-alphabet bytes in the encoded stream.

Options

--decode, -d

decode data

--ignore-garbage, -i

when decoding, ignore non-alphabetic characters

--wrap=<COLS>, -w <COLS>

wrap encoded lines after COLS character (default 76, 0 to disable wrapping)

Examples

Encode the contents of a file as base64 and write the result to stdout:

base64 {{path/to/file}}

Wrap encoded output at a specific width (0 disables wrapping):

base64 --wrap {{0|76|...}} {{path/to/file}}

Decode the base64 contents of a file and write the result to stdout:

base64 --decode {{path/to/file}}

Encode from stdin:

{{somecommand}} | base64

Decode from stdin:

{{somecommand}} | base64 --decode

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.