encode64.plugin.zsh
509 bytes
1encode64() {
2 if [[ $# -eq 0 ]]; then
3 cat | base64
4 else
5 printf '%s' $1 | base64
6 fi
7}
8
9encodefile64() {
10 if [[ $# -eq 0 ]]; then
11 echo "You must provide a filename"
12 else
13 base64 $1 > $1.txt
14 echo "${1}'s content encoded in base64 and saved as ${1}.txt"
15 fi
16}
17
18decode64() {
19 if [[ $# -eq 0 ]]; then
20 cat | base64 --decode
21 else
22 printf '%s' $1 | base64 --decode
23 fi
24}
25alias e64=encode64
26alias ef64=encodefile64
27alias d64=decode64