DefinitelyTyped/types/temp/index.d.ts
Daniel Rosenwasser 526ca393cb Fix lint nits.
2018-04-21 15:47:09 -07:00

49 lines
1.2 KiB
TypeScript

// Type definitions for temp 0.8
// Project: https://www.npmjs.com/package/temp, https://github.com/bruce/node-temp
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as fs from "fs";
declare namespace temp {
interface OpenFile {
path: string;
fd: number;
}
interface Stats {
files: number;
dirs: number;
}
interface AffixOptions {
prefix?: string;
suffix?: string;
dir?: string;
}
let dir: string;
function track(value?: boolean): typeof temp;
function mkdir(affixes?: string | AffixOptions, callback?: (err: any, dirPath: string) => void): void;
function mkdirSync(affixes?: string | AffixOptions): string;
function open(affixes?: string | AffixOptions, callback?: (err: any, result: OpenFile) => void): void;
function openSync(affixes?: string | AffixOptions): OpenFile;
function path(affixes?: string | AffixOptions, defaultPrefix?: string): string;
function cleanup(callback?: (result: boolean | Stats) => void): void;
function cleanupSync(): boolean | Stats;
function createWriteStream(affixes?: string | AffixOptions): fs.WriteStream;
}
export = temp;