Encoder.js Documentation
English
    English
    বাংলা
    Français
    Русский
    Український

What is Encoder.js?

Encoder.js is a text encoder for encrypting data. Encoder.js encodes text into a string that can contain only URL-safe characters (A-Za-z0-9 and -_().~). Encoder.js is designed for browsers (client-side, JavaScript) and server-side (JavaScript or TypeScript), but Encoder.js is incompatible with Node.js, React.js, Next.js, etc.

How to use

Import encode and decode functions:
1 import { encode, decode } from "https://encoder.js.is-a.dev/encoder.js@1.0.1.js";
Example usage:
1 2 3 4 5 6 const text = "Hello, Encoder.js!"; const key = "TOP SECRET KEY"; const encoded = encode(text, key, true); const decoded = decode(encoded, key); console.log(` text: "${text}"\n key: "${key}"\nencoded: "${encoded}"\ndecoded: "${decoded}"`);

encode()

A function for encoding text. Required input data: text - the text to be encoded, type: string. Optional input data: key - encryption key, type: string; compress - whether to compress text (if possible), type: boolean. Output data type: string. Important: Encoding without a key or encoding with a key that looks like text or contains parts of text is not a good idea.

decode()

A function for decoding text. Required input data: text - the text to be decoded, type: string. Optional input data: key - encryption key, type: string. Output data type: string. This function may throw an error if text in the input data is encoded incorrectly, or if it was encoded in a different Encoder.js version that is incompatible with the Encoder.js version you are using.