UNPKG

1.94 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/temp`
3
4# Summary
5This package contains type definitions for temp (https://github.com/bruce/node-temp).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/temp.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/temp/index.d.ts)
10````ts
11/// <reference types="node" />
12
13import * as fs from "fs";
14
15declare namespace temp {
16 interface OpenFile {
17 path: string;
18 fd: number;
19 }
20
21 interface Stats {
22 files: number;
23 dirs: number;
24 }
25
26 interface AffixOptions {
27 prefix?: string | undefined;
28 suffix?: string | undefined;
29 dir?: string | undefined;
30 }
31
32 let dir: string;
33
34 function track(value?: boolean): typeof temp;
35
36 function mkdir(affixes: string | AffixOptions | undefined, callback: (err: any, dirPath: string) => void): void;
37 function mkdir(affixes?: string | AffixOptions): Promise<string>;
38
39 function mkdirSync(affixes?: string | AffixOptions): string;
40
41 function open(affixes: string | AffixOptions | undefined, callback: (err: any, result: OpenFile) => void): void;
42 function open(affixes?: string | AffixOptions): Promise<OpenFile>;
43
44 function openSync(affixes?: string | AffixOptions): OpenFile;
45
46 function path(affixes?: string | AffixOptions, defaultPrefix?: string): string;
47
48 function cleanup(callback: (err: any, result: Stats) => void): void;
49 function cleanup(): Promise<Stats>;
50
51 function cleanupSync(): boolean | Stats;
52
53 function createWriteStream(affixes?: string | AffixOptions): fs.WriteStream;
54}
55
56export = temp;
57
58````
59
60### Additional Details
61 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
62 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
63
64# Credits
65These definitions were written by [Daniel Rosenwasser](https://github.com/DanielRosenwasser).
66
\No newline at end of file