Skip to content

Commit

Permalink
feat: add types definition index.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
onikienko committed Jan 15, 2025
1 parent 4eba204 commit 578c33a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export interface ListItem {
name: string; // name of file/dir (path
size: string; // size
compressed: string; // packed size
date: string; // modified date
time: string; // modified time
attr: string; // attributes
crc: string; // CRC
encrypted: string; // encrypted
method: string; // compression method
block: string; // block
}

export type CallbackFn = (err: Error | null, output?: string) => void;
export type ListCallbackFn = (err: Error | null, listItems?: ListItem[]) => void;

export function unpack(pathToPack: string, destPath?: string): Promise<string>;
export function unpack(pathToPack: string, cb: CallbackFn): void;
export function unpack(pathToPack: string, destPath: string, cb: CallbackFn): void;

export function pack(pathToSrc: string, pathToDest: string): Promise<string>;
export function pack(pathToSrc: string, pathToDest: string, cb: CallbackFn): void;

export function list(pathToSrc: string): Promise<ListItem[]>;
export function list(pathToSrc: string, cb: ListCallbackFn): void;

export function cmd(paramsArr: string[]): Promise<string>;
export function cmd(paramsArr: string[], cb: CallbackFn): void;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.4.5",
"description": "Standalone cross-platform zip/unzip with 7za",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"release": "np --no-yarn --no-cleanup",
"preview": "np --no-yarn --no-cleanup --preview",
Expand Down

0 comments on commit 578c33a

Please sign in to comment.