dencodeme
Version:
Encode/Decode data using various encoding schemes.
34 lines (30 loc) • 1.43 kB
TypeScript
/** Creates a new number system object with the given radix/base. */
declare function base(radix: number): NumberSystem;
/** The number system object interface. */
interface NumberSystem {
/** The character set of the number system. */
readonly charset: string;
/** The radix/base of the number system. */
readonly radix: number;
/** The regex used to match characters in the number system. */
readonly regex: RegExp;
/** Encodes the given data into an encoded string. */
encode(data: string | Buffer, encoding?: BufferEncoding): string;
/** Decodes the given encoded string into a buffer, or a string if a character encoding is provided. */
decode(data: string, encoding?: BufferEncoding): string | Buffer;
}
/** The binary (Base 2) number system object. */
declare const binary: NumberSystem;
/** The octal (Base 8) number system object. */
declare const octal: NumberSystem;
/** The decimal (Base 10) number system object. */
declare const decimal: NumberSystem;
/** The hexadecimal (Base 16) number system object. */
declare const hexadecimal: NumberSystem;
/** The Base 32 number system object. */
declare const base32: NumberSystem;
/** The Base 36 number system object. */
declare const base36: NumberSystem;
/** The Base 64 number system object. */
declare const base64: NumberSystem;
export { NumberSystem, base, base32, base36, base64, binary, decimal, hexadecimal, octal };