DefinitelyTyped/types/temp/index.d.ts
Daniel Mora 4b7b454e31 Update cleanup parameter types for node-temp (#34874)
* Update types for temp

Update types for `cleanup` callback to match the implementation 0082942c73/lib/temp.js (L231)

* Update index.d.ts
2019-04-25 17:24:10 -07:00

49 lines
1.2 KiB
TypeScript

// Type definitions for temp 0.8
// Project: 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?: (err: any, result: Stats) => void): void;
function cleanupSync(): boolean | Stats;
function createWriteStream(affixes?: string | AffixOptions): fs.WriteStream;
}
export = temp;