Add types for detect-character-encoding

This commit is contained in:
Dimitri Benin 2018-11-19 22:36:14 +01:00
parent 1d74d5ac42
commit 75eafa5a64
4 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,10 @@
import detectCharacterEncoding = require("detect-character-encoding");
const buf: Buffer = null as any;
const result: detectCharacterEncoding.Result | null = detectCharacterEncoding(buf);
if (result) {
const str: string = result.encoding;
const num: number = result.confidence;
}

View File

@ -0,0 +1,17 @@
// Type definitions for detect-character-encoding 0.7
// Project: https://github.com/sonicdoe/detect-character-encoding#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
export = detectCharacterEncoding;
declare function detectCharacterEncoding(buf: Buffer): detectCharacterEncoding.Result | null;
declare namespace detectCharacterEncoding {
interface Result {
encoding: string;
confidence: number;
}
}

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"detect-character-encoding-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }