-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add TypeScript definition (#190)
Adds `@types/glob` to `optionalDependencies`.
- Loading branch information
Showing
4 changed files
with
897 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { IOptions as GlobOptions } from 'glob'; | ||
import { Stats } from 'fs'; | ||
|
||
export type CreateOptions = { | ||
dot?: boolean; | ||
globOptions?: GlobOptions; | ||
ordering?: string; | ||
pattern?: string; | ||
transform?: (filePath: string) => string; | ||
unpack?: string; | ||
unpackDir?: string; | ||
}; | ||
|
||
export type ListOptions = { | ||
isPack: boolean; | ||
}; | ||
|
||
export type EntryMetadata = { | ||
unpacked: boolean; | ||
}; | ||
|
||
export type DirectoryMetadata = EntryMetadata & { | ||
files: { [property: string]: EntryMetadata }; | ||
}; | ||
|
||
export type FileMetadata = EntryMetadata & { | ||
executable?: true; | ||
offset?: number; | ||
size?: number; | ||
}; | ||
|
||
export type LinkMetadata = { | ||
link: string; | ||
}; | ||
|
||
export type Metadata = DirectoryMetadata | FileMetadata | LinkMetadata; | ||
|
||
export type InputMetadataType = 'directory' | 'file' | 'link'; | ||
|
||
export type InputMetadata = { | ||
[property: string]: { | ||
type: InputMetadataType; | ||
stat: Stats; | ||
} | ||
}; | ||
|
||
export function createPackage(src: string, dest: string): Promise<void>; | ||
export function createPackageWithOptions( | ||
src: string, | ||
dest: string, | ||
options: CreateOptions | ||
): Promise<void>; | ||
export function createPackageFromFiles( | ||
src: string, | ||
dest: string, | ||
filenames: string[], | ||
metadata?: InputMetadata, | ||
options?: CreateOptions | ||
): Promise<void>; | ||
|
||
export function statFile(archive: string, filename: string, followLinks?: boolean): Metadata; | ||
export function listPackage(archive: string, options?: ListOptions): string[]; | ||
export function extractFile(archive: string, filename: string): Buffer; | ||
export function extractAll(archive: string, dest: string): void; | ||
export function uncache(archive: string): boolean; | ||
export function uncacheAll(): void; |
Oops, something went wrong.