UNPKG

1.19 kBTypeScriptView Raw
1// Type definitions for write-file-atomic 3.0
2// Project: https://github.com/npm/write-file-atomic
3// Definitions by: BendingBender <https://github.com/BendingBender>
4// Piotr Błażejewicz <https://github.com/peterblazejewicz>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6
7/// <reference types="node" />
8
9export = writeFile;
10
11declare function writeFile(filename: string, data: string | Buffer, options: writeFile.Options | BufferEncoding, callback: (error?: Error) => void): void;
12declare function writeFile(filename: string, data: string | Buffer, callback: (error?: Error) => void): void;
13declare function writeFile(filename: string, data: string | Buffer, options?: writeFile.Options | BufferEncoding): Promise<void>;
14
15declare namespace writeFile {
16 function sync(filename: string, data: string | Buffer, options?: Options | BufferEncoding): void;
17
18 interface Options {
19 chown?: {
20 uid: number;
21 gid: number;
22 } | undefined;
23 /**
24 * @default 'utf8'
25 */
26 encoding?: BufferEncoding | undefined;
27 fsync?: boolean | undefined;
28 mode?: number | undefined;
29 }
30}