char-encoding-detector
Version:
Character encoding detector
15 lines (14 loc) • 731 B
TypeScript
import { Options, IMatch } from './type';
/**
* Returns the most probable encoding or the list matching encoding ordered by confidence if { allMatches: true }
* is set in opts parameter.
*/
export declare function detectEncoding(buffer: Uint8Array): string;
export declare function detectEncoding(buffer: Uint8Array, opts: Options): IMatch[];
/**
* Reads the file and returns the character encoding with the highest confidence or
* array of possible character encodings ordered by confidence if { allMatches: true }
* is set in opts parameter.
*/
export declare function detectFileEncoding(file: File): Promise<string>;
export declare function detectFileEncoding(file: File, opts: Options): Promise<IMatch[]>;