2014-07-14 21:50:44 +08:00
|
|
|
# base64
|
|
|
|
|
2024-09-24 22:10:33 +07:00
|
|
|
> Encode or decode file or `stdin` to/from base64, to `stdout`.
|
|
|
|
> More information: <https://manned.org/base64>.
|
2014-07-14 21:50:44 +08:00
|
|
|
|
2024-09-24 22:10:33 +07:00
|
|
|
- Encode a file:
|
2014-07-14 21:50:44 +08:00
|
|
|
|
2022-12-06 07:47:56 +01:00
|
|
|
`base64 {{path/to/file}}`
|
2014-07-14 21:50:44 +08:00
|
|
|
|
2024-03-17 01:11:21 +11:00
|
|
|
- Wrap encoded output at a specific width (`0` disables wrapping):
|
|
|
|
|
2024-09-24 22:10:33 +07:00
|
|
|
`base64 {{-w|--wrap}} {{0|76|...}} {{path/to/file}}`
|
2024-03-17 01:11:21 +11:00
|
|
|
|
2024-09-24 22:10:33 +07:00
|
|
|
- Decode a file:
|
2014-07-14 21:50:44 +08:00
|
|
|
|
2024-09-24 22:10:33 +07:00
|
|
|
`base64 {{-d|--decode}} {{path/to/file}}`
|
2014-07-14 21:50:44 +08:00
|
|
|
|
2022-12-04 08:53:34 +01:00
|
|
|
- Encode from `stdin`:
|
2014-07-14 21:50:44 +08:00
|
|
|
|
2024-09-24 22:10:33 +07:00
|
|
|
`{{command}} | base64`
|
2014-07-14 21:50:44 +08:00
|
|
|
|
2022-12-04 08:53:34 +01:00
|
|
|
- Decode from `stdin`:
|
2014-07-14 21:50:44 +08:00
|
|
|
|
2024-09-24 22:10:33 +07:00
|
|
|
`{{command}} | base64 {{-d|--decode}}`
|