| 1 |
/*--------------------------------------------------------------------------------------------- |
| 2 |
* Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 |
* Licensed under the MIT License. |
| 4 |
* REQUIREMENT: This definition is dependent on the @types/node definition. |
| 5 |
* Install with `npm install @types/node --save-dev` |
| 6 |
*--------------------------------------------------------------------------------------------*/ |
| 7 |
|
| 8 |
declare module 'iconv-lite' { |
| 9 |
// Basic API |
| 10 |
export function decode(buffer: Buffer, encoding: string, options?: Options): string; |
| 11 |
|
| 12 |
export function encode(content: string, encoding: string, options?: Options): Buffer; |
| 13 |
|
| 14 |
export function encodingExists(encoding: string): boolean; |
| 15 |
|
| 16 |
// Stream API |
| 17 |
export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; |
| 18 |
|
| 19 |
export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; |
| 20 |
|
| 21 |
// Low-level stream APIs |
| 22 |
export function getEncoder(encoding: string, options?: Options): EncoderStream; |
| 23 |
|
| 24 |
export function getDecoder(encoding: string, options?: Options): DecoderStream; |
| 25 |
} |
| 26 |
|
| 27 |
export interface Options { |
| 28 |
stripBOM?: boolean; |
| 29 |
addBOM?: boolean; |
| 30 |
defaultEncoding?: string; |
| 31 |
} |
| 32 |
|
| 33 |
export interface EncoderStream { |
| 34 |
write(str: string): Buffer; |
| 35 |
end(): Buffer | undefined; |
| 36 |
} |
| 37 |
|
| 38 |
export interface DecoderStream { |
| 39 |
write(buf: Buffer): string; |
| 40 |
end(): string | undefined; |
| 41 |
} |