Convert any kind of String into a url-friendly parameter using Huffman Encoding.
npm install --save huffman-url-compressor
- Train (string): Training set used to create the encoder. This is where the algorithm gets the frequency for each char.
- Test (string): String that you want to encode.
import {createEncoder, encodeConfig, decodeConfig} from 'huffman-url-compressor';
//create encoder
let Encoder = createEncoder(train);
//create a base64 encoded stream
let encodedParam = encodeConfig(test,Encoder)
//retrieve the original param
let decodParam= decodeConfig(encodedParam,Encoder)