DefinitelyTyped/types/tmp/index.d.ts
2019-02-12 14:36:28 -08:00

44 lines
1.5 KiB
TypeScript

// Type definitions for tmp 0.0
// Project: http://github.com/raszi/node-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;