Skip to content

Commit f9eb91d

Browse files
authored
feat: add TypeScript definition (#190)
Adds `@types/glob` to `optionalDependencies`.
1 parent c93997d commit f9eb91d

File tree

4 files changed

+897
-12
lines changed

4 files changed

+897
-12
lines changed

lib/index.d.ts

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { IOptions as GlobOptions } from 'glob';
2+
import { Stats } from 'fs';
3+
4+
export type CreateOptions = {
5+
dot?: boolean;
6+
globOptions?: GlobOptions;
7+
ordering?: string;
8+
pattern?: string;
9+
transform?: (filePath: string) => string;
10+
unpack?: string;
11+
unpackDir?: string;
12+
};
13+
14+
export type ListOptions = {
15+
isPack: boolean;
16+
};
17+
18+
export type EntryMetadata = {
19+
unpacked: boolean;
20+
};
21+
22+
export type DirectoryMetadata = EntryMetadata & {
23+
files: { [property: string]: EntryMetadata };
24+
};
25+
26+
export type FileMetadata = EntryMetadata & {
27+
executable?: true;
28+
offset?: number;
29+
size?: number;
30+
};
31+
32+
export type LinkMetadata = {
33+
link: string;
34+
};
35+
36+
export type Metadata = DirectoryMetadata | FileMetadata | LinkMetadata;
37+
38+
export type InputMetadataType = 'directory' | 'file' | 'link';
39+
40+
export type InputMetadata = {
41+
[property: string]: {
42+
type: InputMetadataType;
43+
stat: Stats;
44+
}
45+
};
46+
47+
export function createPackage(src: string, dest: string): Promise<void>;
48+
export function createPackageWithOptions(
49+
src: string,
50+
dest: string,
51+
options: CreateOptions
52+
): Promise<void>;
53+
export function createPackageFromFiles(
54+
src: string,
55+
dest: string,
56+
filenames: string[],
57+
metadata?: InputMetadata,
58+
options?: CreateOptions
59+
): Promise<void>;
60+
61+
export function statFile(archive: string, filename: string, followLinks?: boolean): Metadata;
62+
export function listPackage(archive: string, options?: ListOptions): string[];
63+
export function extractFile(archive: string, filename: string): Buffer;
64+
export function extractAll(archive: string, dest: string): void;
65+
export function uncache(archive: string): boolean;
66+
export function uncacheAll(): void;

0 commit comments

Comments
 (0)