-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbase64encode.sh
More file actions
26 lines (23 loc) · 745 Bytes
/
base64encode.sh
File metadata and controls
26 lines (23 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
#------------------------------------------------------------------------------
# written by: mcdaniel
# https://lawrencemcdaniel.com
#
# date: sep-2023
#
# usage: Generate a base64 encoded representation of a binary file
#------------------------------------------------------------------------------
if [ $# == 1 ]; then
# see https://www.mytecbits.com/apple/macos/image-to-base64
base64 -i $1 -o $1-encoded
# this is an alternate implementation that works 80% of the time
# openssl base64 -in $1 -out $1-encoded
exit 0
fi
if [ $# == 2 ]; then
openssl base64 -in $1 -out $2
else
echo "base64encode.sh"
echo "Usage: ./base64encode.sh <infile> <outfile>"
exit 1
fi