UNPKG

huffman-ts

Version:

Huffman ts is an implementation of Huffman Algorithm in Typescript. It provides full compatibility with Huffman algorithm reference.

20 lines (19 loc) 683 B
import { TreeNode } from "./TreeNode"; import { HuffmanEncoded } from "./type"; export declare class Tree { root: TreeNode; leafCache: { [key: string]: string; }; constructor(root: TreeNode); stringToBitString(encoded: string): string; bitStringToString(bitString: string): string; encode(text: string): string; decode(encoded: string): string; encodeBitString(text: string): string; bitValue(ch: string): string; generateLeafCache(node?: TreeNode, path?: string): void; encodeTree(): HuffmanEncoded; static decodeTree(data: HuffmanEncoded): Tree; static parseNode(data: HuffmanEncoded): TreeNode; }