UNPKG

1.76 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/write-file-atomic`
3
4# Summary
5This package contains type definitions for write-file-atomic (https://github.com/npm/write-file-atomic).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/write-file-atomic.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/write-file-atomic/index.d.ts)
10````ts
11/// <reference types="node" />
12
13export = writeFile;
14
15declare function writeFile(
16 filename: string,
17 data: string | Buffer,
18 options: writeFile.Options | BufferEncoding,
19 callback: (error?: Error) => void,
20): void;
21declare function writeFile(filename: string, data: string | Buffer, callback: (error?: Error) => void): void;
22declare function writeFile(
23 filename: string,
24 data: string | Buffer,
25 options?: writeFile.Options | BufferEncoding,
26): Promise<void>;
27
28declare namespace writeFile {
29 function sync(filename: string, data: string | Buffer, options?: Options | BufferEncoding): void;
30
31 interface Options {
32 chown?:
33 | {
34 uid: number;
35 gid: number;
36 }
37 | undefined;
38 /**
39 * @default 'utf8'
40 */
41 encoding?: BufferEncoding | undefined;
42 fsync?: boolean | undefined;
43 mode?: number | undefined;
44 tmpfileCreated?: ((tmpfile: string) => void) | undefined;
45 }
46}
47
48````
49
50### Additional Details
51 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
52 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
53
54# Credits
55These definitions were written by [BendingBender](https://github.com/BendingBender), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
56
\No newline at end of file