Skip to content

Commit

Permalink
Added TypeScript typings (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAkio authored and abalabahaha committed Oct 31, 2019
1 parent 54d7693 commit 23fc944
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
51 changes: 51 additions & 0 deletions index.d.ts
@@ -0,0 +1,51 @@
declare module 'zlib-sync' {
export interface InflateOptions {
chunkSize?: number;
to?: 'string';
windowBits?: number;
}

export class Inflate {
readonly windowBits: number;
readonly result: Buffer | string | null;
readonly msg: string | null;
readonly err: number;
readonly chunkSize: number;
public constructor(options?: InflateOptions);
public push(buffer: Buffer, flush?: boolean | number): void;
}

export const Z_NO_FLUSH: number;
export const Z_PARTIAL_FLUSH: number;
export const Z_SYNC_FLUSH: number;
export const Z_FULL_FLUSH: number;
export const Z_FINISH: number;
export const Z_BLOCK: number;
export const Z_TREES: number;
export const Z_OK: number;
export const Z_STREAM_END: number;
export const Z_NEED_DICT: number;
export const Z_ERRNO: number;
export const Z_STREAM_ERROR: number;
export const Z_DATA_ERROR: number;
export const Z_MEM_ERROR: number;
export const Z_BUF_ERROR: number;
export const Z_VERSION_ERROR: number;
export const Z_NO_COMPRESSION: number;
export const Z_BEST_SPEED: number;
export const Z_BEST_COMPRESSION: number;
export const Z_DEFAULT_COMPRESSION: number;
export const Z_FILTERED: number;
export const Z_HUFFMAN_ONLY: number;
export const Z_RLE: number;
export const Z_FIXED: number;
export const Z_DEFAULT_STRATEGY: number;
export const Z_BINARY: number;
export const Z_TEXT: number;
export const Z_ASCII: number;
export const Z_UNKNOWN: number;
export const Z_DEFLATED: number;
export const Z_NULL: number;

export const ZLIB_VERSION: string;
}
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.5",
"description": "Synchronous zlib bindings for NodeJS",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"lint": "eslint --fix test",
"test": "mocha"
Expand All @@ -25,6 +26,7 @@
"nan": "^2.14.0"
},
"devDependencies": {
"@types/node": "^12.11.7",
"mocha": "^4.0.1"
}
}

0 comments on commit 23fc944

Please sign in to comment.