@types/chardet
Version:
TypeScript definitions for chardet
48 lines (34 loc) • 1.81 kB
Markdown
# Installation
> `npm install --save @types/chardet`
# Summary
This package contains type definitions for chardet (https://github.com/runk/node-chardet).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chardet.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chardet/index.d.ts)
````ts
/// <reference types="node" />
export interface Confidence {
name: string;
confidence: number;
lang?: string | undefined;
}
export interface Options {
returnAllMatches?: boolean | undefined;
sampleSize?: number | undefined;
}
// As of v0.6, these fns return the highest-confidence result
export function detect(buf: Buffer, opts?: Options): string | null;
export function detectFile(path: string, cb: (err: any, result: string | null) => void): void;
export function detectFile(path: string, opts: Options, cb: (err: any, result: string | null) => void): void;
export function detectFileSync(path: string, opts?: Options): string | null;
// These fns were introduced in v0.6 to return an array of confidences.
export function detectAll(buf: Buffer, opts?: Options): Confidence[] | null;
export function detectFileAll(path: string, cb: (err: any, result: Confidence[] | null) => void): void;
export function detectFileAll(path: string, opts: Options, cb: (err: any, result: Confidence[] | null) => void): void;
export function detectFileAllSync(path: string, opts?: Options): Confidence[] | null;
````
### Additional Details
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
# Credits
These definitions were written by [Hauke Oldsen](https://github.com/Gebatzens), and [Sam Hinshaw](https://github.com/samhinshaw).