encoding-helper/index.d.ts

39 lines
966 B
TypeScript

/**
* encode a string to base64
*
* @param {string} str string to encode
* @param {string} encoding encoding the string is in
* @returns {string} base64
*/
export function to_b64(str: string, encoding?: string): string;
/**
* encode a string to hex
*
* @param {string} str string to encode
* @param {string} encoding encoding the string is in
* @returns {string} hex
*/
export function to_hex(str: string, encoding?: string): string;
/**
* encode a string to utf-8
*
* @param {string} str string to encode
* @param {string} encoding encoding the string is in
* @returns {string} utf-8
*/
export function to_utf8(str: string, encoding: string): string;
/**
* encode a number to hex
*
* @param {number} n number to encode
* @returns {string} hex
*/
export function num_to_hex(n: number): string;
/**
* decode a number from hex
*
* @param {string} h hex to decode
* @returns {number} number
*/
export function hex_to_num(h: string): number;