UNPKG

4.69 kBTypeScriptView Raw
1// Type definitions for fs-extra-promise 1.0
2// Project: https://github.com/overlookmotel/fs-extra-promise
3// Definitions by: midknight41 <https://github.com/midknight41>, Jason Swearingen <https://github.com/jasonswearingen>, Hiromi Shikata <https://github.com/HiromiShikata>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// TypeScript Version: 3.2
6
7/// <reference types="node" />
8
9import * as stream from 'stream';
10import * as fs from 'fs';
11import * as Promise from 'bluebird';
12import { CopyFilter, CopyOptions, ReadOptions, WriteOptions, MoveOptions } from 'fs-extra';
13import Stats = fs.Stats;
14
15export * from 'fs-extra';
16
17export interface MkdirOptions {
18 fs?: any;
19 mode?: number | undefined;
20}
21
22// promisified versions
23export function copyAsync(src: string, dest: string, options?: CopyFilter | CopyOptions): Promise<void>;
24
25export function createFileAsync(file: string): Promise<void>;
26
27export function mkdirsAsync(dir: string, options?: MkdirOptions): Promise<void>;
28export function mkdirpAsync(dir: string, options?: MkdirOptions): Promise<void>;
29
30export function moveAsync(src: string, dest: string, options?: MoveOptions): Promise<void>;
31
32export function outputFileAsync(file: string, data: any): Promise<void>;
33
34export function outputJsonAsync(file: string, data: any): Promise<void>;
35export function outputJSONAsync(file: string, data: any): Promise<void>;
36
37export function readJsonAsync(file: string, options?: ReadOptions): Promise<any>;
38export function readJSONAsync(file: string, options?: ReadOptions): Promise<any>;
39
40export function removeAsync(dir: string): Promise<void>;
41
42export function writeJsonAsync(file: string, object: any, options?: WriteOptions): Promise<void>;
43export function writeJSONAsync(file: string, object: any, options?: WriteOptions): Promise<void>;
44
45export function renameAsync(oldPath: string, newPath: string): Promise<void>;
46export function truncateAsync(fd: number, len: number): Promise<void>;
47export function chownAsync(path: string, uid: number, gid: number): Promise<void>;
48export function fchownAsync(fd: number, uid: number, gid: number): Promise<void>;
49export function lchownAsync(path: string, uid: number, gid: number): Promise<void>;
50export function chmodAsync(path: string, mode: number | string): Promise<void>;
51export function fchmodAsync(fd: number, mode: number | string): Promise<void>;
52export function lchmodAsync(path: string, mode: number | string): Promise<void>;
53export function statAsync(path: string): Promise<Stats>;
54export function lstatAsync(path: string): Promise<Stats>;
55export function fstatAsync(fd: number): Promise<Stats>;
56export function linkAsync(srcpath: string, dstpath: string): Promise<void>;
57export function symlinkAsync(srcpath: string, dstpath: string, type?: fs.symlink.Type): Promise<void>;
58export function readlinkAsync(path: string): Promise<string>;
59export function realpathAsync(path: string, cache?: { [path: string]: string }): Promise<string>;
60export function unlinkAsync(path: string): Promise<void>;
61export function rmdirAsync(path: string): Promise<void>;
62export function mkdirAsync(path: string, mode?: number | string): Promise<void>;
63export function readdirAsync(path: string): Promise<string[]>;
64export function closeAsync(fd: number): Promise<void>;
65export function openAsync(path: string, flags: string, mode?: string): Promise<number>;
66export function utimesAsync(path: string, atime: number, mtime: number): Promise<void>;
67export function futimesAsync(fd: number, atime: number, mtime: number): Promise<void>;
68export function fsyncAsync(fd: number): Promise<void>;
69export function writeAsync(fd: number, buffer: Buffer, offset: number, length: number, position: number): Promise<[number, Buffer]>;
70export function readAsync(fd: number, buffer: Buffer, offset: number, length: number, position: number): Promise<[number, Buffer]>;
71export function readFileAsync(filename: string, options: string | ReadOptions): Promise<string>;
72export function readFileAsync(filename: string): Promise<Buffer>;
73export function writeFileAsync(filename: string, data: any, options?: string | WriteOptions): Promise<void>;
74export function mkdtempAsync(prefix: string, options: string | {encoding: string}): Promise<string>;
75export function appendFileAsync(filename: string, data: any, option?: string | WriteOptions): Promise<void>;
76
77export function existsAsync(path: string): Promise<boolean>;
78export function ensureDirAsync(path: string): Promise<void>;
79
80export function isDirectory(path: string, callback?: (err: Error, isDirectory: boolean) => void): void;
81export function isDirectorySync(path: string): boolean;
82export function isDirectoryAsync(path: string): Promise<boolean>;