Skip to content

Commit 1e7e030

Browse files
Update test.sh
1 parent 1283110 commit 1e7e030

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@
22

33
# Define the script URL
44
SCRIPT_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
711
encode() {
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
1519
decode() {
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

0 commit comments

Comments
 (0)