File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 22
33# Define the script URL
44SCRIPT_URL=" https://js.is-a.dev/encoder/latest"
5+ LOCAL_SCRIPT=" encoder.js"
6+
7+ # Download the script locally
8+ curl -s -o " $LOCAL_SCRIPT " " $SCRIPT_URL "
59
610# Function to encode text
711encode () {
812 local text=" $1 "
913 local key=" $2 "
1014 local compress=" $3 "
11- curl -s " $SCRIPT_URL " | node -e " import { encode } from '$SCRIPT_URL '; console.log(encode('$text ', '$key ', $compress ));"
15+ node -e " import { encode } from './ $LOCAL_SCRIPT '; console.log(encode('$text ', '$key ', $compress ));"
1216}
1317
1418# Function to decode text
1519decode () {
1620 local text=" $1 "
1721 local key=" $2 "
18- curl -s " $SCRIPT_URL " | node -e " import { decode } from '$SCRIPT_URL '; console.log(decode('$text ', '$key '));"
22+ node -e " import { decode } from './ $LOCAL_SCRIPT '; console.log(decode('$text ', '$key '));"
1923}
2024
2125# Example usage
You can’t perform that action at this time.
0 commit comments