Z User
phase7: MCP stdio smoke test (handshake + tools/list + get_roots 6:74) — 4/4 tests PASS
54a6341 Download node_modules/hono/dist/utils/encode.js from bravesigma/quran-md-plugin: direct link, hf CLI and curl.
- Browser
- Download file 901 Bytes
-
https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/utils/encode.js
- Command line
-
hf download hf://datasets/bravesigma/quran-md-plugin/node_modules/hono/dist/utils/encode.js
-
curl -L -o encode.js https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/utils/encode.js
901 Bytes
| //#region src/utils/encode.ts | |
| /** | |
| * @module | |
| * Encode utility. | |
| */ | |
| const decodeBase64Url = (str) => { | |
| return decodeBase64(str.replace(/_|-/g, (m) => ({ | |
| _: "/", | |
| "-": "+" | |
| })[m] ?? m)); | |
| }; | |
| const encodeBase64Url = (buf) => encodeBase64(buf).replace(/\/|\+/g, (m) => ({ | |
| "/": "_", | |
| "+": "-" | |
| })[m] ?? m); | |
| const encodeBase64 = (buf) => { | |
| let binary = ""; | |
| const bytes = new Uint8Array(buf); | |
| for (let i = 0, len = bytes.length; i < len; i++) binary += String.fromCharCode(bytes[i]); | |
| return btoa(binary); | |
| }; | |
| const decodeBase64 = (str) => { | |
| const binary = atob(str); | |
| const bytes = new Uint8Array(new ArrayBuffer(binary.length)); | |
| const half = binary.length / 2; | |
| for (let i = 0, j = binary.length - 1; i <= half; i++, j--) { | |
| bytes[i] = binary.charCodeAt(i); | |
| bytes[j] = binary.charCodeAt(j); | |
| } | |
| return bytes; | |
| }; | |
| //#endregion | |
| export { decodeBase64, decodeBase64Url, encodeBase64, encodeBase64Url }; | |