source: trip-planner-front/node_modules/memfs/lib/promises.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.2 KB
Line 
1/// <reference types="node" />
2import { Volume, TData, TMode, TFlags, TFlagsCopy, TTime, IOptions, IAppendFileOptions, IMkdirOptions, IReaddirOptions, IReadFileOptions, IRealpathOptions, IWriteFileOptions, IStatOptions, IRmOptions } from './volume';
3import Stats from './Stats';
4import Dirent from './Dirent';
5import { TDataOut } from './encoding';
6import { PathLike, symlink } from 'fs';
7export interface TFileHandleReadResult {
8 bytesRead: number;
9 buffer: Buffer | Uint8Array;
10}
11export interface TFileHandleWriteResult {
12 bytesWritten: number;
13 buffer: Buffer | Uint8Array;
14}
15export interface IFileHandle {
16 fd: number;
17 appendFile(data: TData, options?: IAppendFileOptions | string): Promise<void>;
18 chmod(mode: TMode): Promise<void>;
19 chown(uid: number, gid: number): Promise<void>;
20 close(): Promise<void>;
21 datasync(): Promise<void>;
22 read(buffer: Buffer | Uint8Array, offset: number, length: number, position: number): Promise<TFileHandleReadResult>;
23 readFile(options?: IReadFileOptions | string): Promise<TDataOut>;
24 stat(options?: IStatOptions): Promise<Stats>;
25 truncate(len?: number): Promise<void>;
26 utimes(atime: TTime, mtime: TTime): Promise<void>;
27 write(buffer: Buffer | Uint8Array, offset?: number, length?: number, position?: number): Promise<TFileHandleWriteResult>;
28 writeFile(data: TData, options?: IWriteFileOptions): Promise<void>;
29}
30export declare type TFileHandle = PathLike | IFileHandle;
31export interface IPromisesAPI {
32 FileHandle: any;
33 access(path: PathLike, mode?: number): Promise<void>;
34 appendFile(path: TFileHandle, data: TData, options?: IAppendFileOptions | string): Promise<void>;
35 chmod(path: PathLike, mode: TMode): Promise<void>;
36 chown(path: PathLike, uid: number, gid: number): Promise<void>;
37 copyFile(src: PathLike, dest: PathLike, flags?: TFlagsCopy): Promise<void>;
38 lchmod(path: PathLike, mode: TMode): Promise<void>;
39 lchown(path: PathLike, uid: number, gid: number): Promise<void>;
40 link(existingPath: PathLike, newPath: PathLike): Promise<void>;
41 lstat(path: PathLike, options?: IStatOptions): Promise<Stats>;
42 mkdir(path: PathLike, options?: TMode | IMkdirOptions): Promise<void>;
43 mkdtemp(prefix: string, options?: IOptions): Promise<TDataOut>;
44 open(path: PathLike, flags: TFlags, mode?: TMode): Promise<FileHandle>;
45 readdir(path: PathLike, options?: IReaddirOptions | string): Promise<TDataOut[] | Dirent[]>;
46 readFile(id: TFileHandle, options?: IReadFileOptions | string): Promise<TDataOut>;
47 readlink(path: PathLike, options?: IOptions): Promise<TDataOut>;
48 realpath(path: PathLike, options?: IRealpathOptions | string): Promise<TDataOut>;
49 rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
50 rmdir(path: PathLike): Promise<void>;
51 rm(path: PathLike, options?: IRmOptions): Promise<void>;
52 stat(path: PathLike, options?: IStatOptions): Promise<Stats>;
53 symlink(target: PathLike, path: PathLike, type?: symlink.Type): Promise<void>;
54 truncate(path: PathLike, len?: number): Promise<void>;
55 unlink(path: PathLike): Promise<void>;
56 utimes(path: PathLike, atime: TTime, mtime: TTime): Promise<void>;
57 writeFile(id: TFileHandle, data: TData, options?: IWriteFileOptions): Promise<void>;
58}
59export declare class FileHandle implements IFileHandle {
60 private vol;
61 fd: number;
62 constructor(vol: Volume, fd: number);
63 appendFile(data: TData, options?: IAppendFileOptions | string): Promise<void>;
64 chmod(mode: TMode): Promise<void>;
65 chown(uid: number, gid: number): Promise<void>;
66 close(): Promise<void>;
67 datasync(): Promise<void>;
68 read(buffer: Buffer | Uint8Array, offset: number, length: number, position: number): Promise<TFileHandleReadResult>;
69 readFile(options?: IReadFileOptions | string): Promise<TDataOut>;
70 stat(options?: IStatOptions): Promise<Stats>;
71 sync(): Promise<void>;
72 truncate(len?: number): Promise<void>;
73 utimes(atime: TTime, mtime: TTime): Promise<void>;
74 write(buffer: Buffer | Uint8Array, offset?: number, length?: number, position?: number): Promise<TFileHandleWriteResult>;
75 writeFile(data: TData, options?: IWriteFileOptions): Promise<void>;
76}
77export default function createPromisesApi(vol: Volume): null | IPromisesAPI;
Note: See TracBrowser for help on using the repository browser.