chardet
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Match } from '../match'; | ||
@@ -11,6 +10,6 @@ export interface Recogniser { | ||
fC1Bytes: boolean; | ||
fRawInput: Buffer; | ||
fRawInput: Uint8Array; | ||
fRawLength: number; | ||
fInputBytes: Buffer; | ||
fInputBytes: Uint8Array; | ||
fInputLen: number; | ||
} |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Context, Recogniser } from '.'; | ||
@@ -12,7 +11,7 @@ export declare class UTF_16BE implements Recogniser { | ||
interface WithGetChar { | ||
getChar(input: Buffer, index: number): number; | ||
getChar(input: Uint8Array, index: number): number; | ||
} | ||
declare class UTF_32 implements Recogniser, WithGetChar { | ||
name(): string; | ||
getChar(input: Buffer, index: number): number; | ||
getChar(input: Uint8Array, index: number): number; | ||
match(det: Context): any; | ||
@@ -22,8 +21,8 @@ } | ||
name(): string; | ||
getChar(input: Buffer, index: number): number; | ||
getChar(input: Uint8Array, index: number): number; | ||
} | ||
export declare class UTF_32LE extends UTF_32 { | ||
name(): string; | ||
getChar(input: Buffer, index: number): number; | ||
getChar(input: Uint8Array, index: number): number; | ||
} | ||
export {}; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Match } from './match'; | ||
@@ -7,9 +6,9 @@ interface FullOptions { | ||
declare type DetectResult = Match[] | string | null; | ||
export declare const detect: (buffer: Buffer) => string | null; | ||
export declare const analyse: (buffer: Buffer) => Match[]; | ||
export declare const detect: (buffer: Uint8Array) => string | null; | ||
export declare const analyse: (buffer: Uint8Array) => Match[]; | ||
export declare const detectFile: (filepath: string, opts?: Partial<FullOptions>) => Promise<DetectResult>; | ||
export declare const detectFileSync: (filepath: string, opts?: Partial<FullOptions>) => DetectResult; | ||
declare const _default: { | ||
analyse: (buffer: Buffer) => Match[]; | ||
detect: (buffer: Buffer) => string | null; | ||
analyse: (buffer: Uint8Array) => Match[]; | ||
detect: (buffer: Uint8Array) => string | null; | ||
detectFileSync: (filepath: string, opts?: Partial<FullOptions>) => DetectResult; | ||
@@ -16,0 +15,0 @@ detectFile: (filepath: string, opts?: Partial<FullOptions>) => Promise<DetectResult>; |
{ | ||
"name": "chardet", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"homepage": "https://github.com/runk/node-chardet", | ||
@@ -5,0 +5,0 @@ "description": "Character detector", |
@@ -12,6 +12,6 @@ import { Match } from '../match'; | ||
fC1Bytes: boolean; | ||
fRawInput: Buffer; | ||
fRawInput: Uint8Array; | ||
fRawLength: number; | ||
fInputBytes: Buffer; | ||
fInputBytes: Uint8Array; | ||
fInputLen: number; | ||
} |
@@ -55,3 +55,3 @@ import { Context, Recogniser } from '.'; | ||
interface WithGetChar { | ||
getChar(input: Buffer, index: number): number; | ||
getChar(input: Uint8Array, index: number): number; | ||
} | ||
@@ -64,3 +64,3 @@ | ||
getChar(input: Buffer, index: number): number { | ||
getChar(input: Uint8Array, index: number): number { | ||
return -1; | ||
@@ -119,3 +119,3 @@ } | ||
} | ||
getChar(input: Buffer, index: number) { | ||
getChar(input: Uint8Array, index: number) { | ||
return ( | ||
@@ -135,3 +135,3 @@ ((input[index + 0] & 0xff) << 24) | | ||
getChar(input: Buffer, index: number) { | ||
getChar(input: Uint8Array, index: number) { | ||
return ( | ||
@@ -138,0 +138,0 @@ ((input[index + 3] & 0xff) << 24) | |
@@ -53,3 +53,3 @@ import { Match } from './match'; | ||
export const detect = (buffer: Buffer): string | null => { | ||
export const detect = (buffer: Uint8Array): string | null => { | ||
const matches: Match[] = analyse(buffer); | ||
@@ -59,3 +59,3 @@ return matches.length > 0 ? matches[0].name : null; | ||
export const analyse = (buffer: Buffer): Match[] => { | ||
export const analyse = (buffer: Uint8Array): Match[] => { | ||
// Tally up the byte occurrence statistics. | ||
@@ -62,0 +62,0 @@ const fByteStats = []; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1183757
12494