more space efficient encoding than base64
Encoding:
import { encode } from "https://deno.land/x/[email protected]/base91.ts";
const encoder = new TextEncoder(); //converts utf-8 string to Uint8Array
const input = encoder.encode("test"); //Uint8Array(4) [ 116, 101, 115, 116 ]
const result = encode(input); //"fPNKd"
Decoding:
import { decode } from "https://deno.land/x/[email protected]/base91.ts";
const decoder = new TextDecoder("utf-8"); //used to convert Uint8Array to utf-8 string
const result = decode("fPNKd"); //Uint8Array(4) [ 116, 101, 115, 116 ]
const output = decoder.decode(result); //"test"
Run tests:
deno test
This project is using Deno built-in formatter. You can format your code using:
deno fmt
Or ensure it's following its rules with:
deno fmt --check