DefinitelyTyped/types/tmp/index.d.ts
Gyusun Yeom 265397ccd3 add missing options for tmp & lint (#16138)
* add missing options

* add tslint

* fix lint error
2017-05-03 14:49:18 -07:00

44 lines
1.5 KiB
TypeScript

// Type definitions for tmp 0.0
// Project: https://www.npmjs.com/package/tmp
// Definitions by: Jared Klopper <https://github.com/optical>, Gyusun Yeom <https://github.com/Perlmint>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Options extends SimpleOptions {
mode?: number;
discardDescriptor?: boolean;
detachDescriptor?: boolean;
}
export interface SimpleOptions {
prefix?: string;
postfix?: string;
template?: string;
dir?: string;
tries?: number;
keep?: boolean;
unsafeCleanup?: boolean;
}
export interface SynchrounousResult {
name: string;
fd: number;
removeCallback(): void;
}
export function file(callback: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
export function file(config: Options, callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
export function fileSync(config?: Options): SynchrounousResult;
export function dir(callback: (err: any, path: string, cleanupCallback: () => void) => void): void;
export function dir(config: Options, callback?: (err: any, path: string, cleanupCallback: () => void) => void): void;
export function dirSync(config?: Options): SynchrounousResult;
export function tmpName(callback: (err: any, path: string) => void): void;
export function tmpName(config: SimpleOptions, callback?: (err: any, path: string) => void): void;
export function tmpNameSync(config?: SimpleOptions): string;
export function setGracefulCleanup(): void;