Spaces:
Paused
Paused
Download node_modules/@peculiar/utils/build/esm/encoding/binary.js from Leon4gr45/augmenttoolkit: direct link, hf CLI and curl.
- Browser
- Download file 553 Bytes
-
https://huggingface.co/spaces/Leon4gr45/augmenttoolkit/resolve/main/node_modules/%40peculiar/utils/build/esm/encoding/binary.js
- Command line
-
hf download hf://spaces/Leon4gr45/augmenttoolkit/node_modules/@peculiar/utils/build/esm/encoding/binary.js
-
curl -L -o binary.js https://huggingface.co/spaces/Leon4gr45/augmenttoolkit/resolve/main/node_modules/%40peculiar/utils/build/esm/encoding/binary.js
553 Bytes
| import { toUint8Array } from "../bytes/index.js"; | |
| export function encode(data) { | |
| const bytes = toUint8Array(data); | |
| let result = ""; | |
| for (const byte of bytes) { | |
| result += String.fromCharCode(byte); | |
| } | |
| return result; | |
| } | |
| export function decode(text) { | |
| const result = new Uint8Array(text.length); | |
| for (let i = 0; i < text.length; i++) { | |
| result[i] = text.charCodeAt(i) & 0xff; | |
| } | |
| return result; | |
| } | |
| export function is(text) { | |
| return typeof text === "string"; | |
| } | |
| export const binary = { encode, decode, is }; | |