@zenfs/core 0.0.12 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ApiError.d.ts +52 -15
- package/dist/ApiError.js +77 -50
- package/dist/FileIndex.d.ts +32 -35
- package/dist/FileIndex.js +93 -109
- package/dist/backends/AsyncMirror.d.ts +42 -43
- package/dist/backends/AsyncMirror.js +154 -147
- package/dist/backends/AsyncStore.d.ts +29 -28
- package/dist/backends/AsyncStore.js +375 -482
- package/dist/backends/FolderAdapter.js +8 -19
- package/dist/backends/InMemory.d.ts +16 -13
- package/dist/backends/InMemory.js +29 -14
- package/dist/backends/Locked.d.ts +8 -28
- package/dist/backends/Locked.js +74 -224
- package/dist/backends/OverlayFS.d.ts +26 -34
- package/dist/backends/OverlayFS.js +303 -511
- package/dist/backends/SyncStore.d.ts +54 -72
- package/dist/backends/SyncStore.js +159 -161
- package/dist/backends/backend.d.ts +45 -29
- package/dist/backends/backend.js +83 -13
- package/dist/backends/index.d.ts +6 -7
- package/dist/backends/index.js +5 -6
- package/dist/browser.min.js +21 -6
- package/dist/browser.min.js.map +4 -4
- package/dist/emulation/callbacks.d.ts +119 -113
- package/dist/emulation/callbacks.js +129 -92
- package/dist/emulation/constants.js +1 -1
- package/dist/emulation/dir.d.ts +55 -0
- package/dist/emulation/dir.js +104 -0
- package/dist/emulation/fs.d.ts +1 -2
- package/dist/emulation/fs.js +0 -1
- package/dist/emulation/index.d.ts +3 -0
- package/dist/emulation/index.js +3 -0
- package/dist/emulation/promises.d.ts +265 -145
- package/dist/emulation/promises.js +526 -383
- package/dist/emulation/shared.d.ts +20 -6
- package/dist/emulation/shared.js +22 -23
- package/dist/emulation/streams.d.ts +102 -0
- package/dist/emulation/streams.js +55 -0
- package/dist/emulation/sync.d.ts +98 -69
- package/dist/emulation/sync.js +280 -133
- package/dist/file.d.ts +175 -173
- package/dist/file.js +257 -273
- package/dist/filesystem.d.ts +71 -244
- package/dist/filesystem.js +67 -472
- package/dist/index.d.ts +7 -44
- package/dist/index.js +22 -75
- package/dist/inode.d.ts +37 -28
- package/dist/inode.js +123 -65
- package/dist/stats.d.ts +91 -36
- package/dist/stats.js +138 -110
- package/dist/utils.d.ts +26 -13
- package/dist/utils.js +79 -107
- package/package.json +7 -4
- package/readme.md +2 -40
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import type
|
|
4
|
-
import {
|
|
5
|
-
import { Stats } from '../stats.js';
|
|
3
|
+
import type * as Node from 'fs';
|
|
4
|
+
import { TwoArgCallback, NoArgCallback, ThreeArgCallback, FileContents } from '../filesystem.js';
|
|
5
|
+
import { BigIntStats, Stats } from '../stats.js';
|
|
6
|
+
import { PathLike } from './shared.js';
|
|
7
|
+
import { ReadStream, WriteStream } from './streams.js';
|
|
8
|
+
import { Dirent } from './dir.js';
|
|
6
9
|
/**
|
|
7
10
|
* Asynchronous rename. No arguments other than a possible exception are given
|
|
8
11
|
* to the completion callback.
|
|
@@ -10,24 +13,27 @@ import { Stats } from '../stats.js';
|
|
|
10
13
|
* @param newPath
|
|
11
14
|
* @param callback
|
|
12
15
|
*/
|
|
13
|
-
export declare function rename(oldPath:
|
|
16
|
+
export declare function rename(oldPath: PathLike, newPath: PathLike, cb?: NoArgCallback): void;
|
|
14
17
|
/**
|
|
15
18
|
* Test whether or not the given path exists by checking with the file system.
|
|
16
19
|
* Then call the callback argument with either true or false.
|
|
17
|
-
* @example Sample invocation
|
|
18
|
-
* fs.exists('/etc/passwd', function (exists) {
|
|
19
|
-
* util.debug(exists ? "it's there" : "no passwd!");
|
|
20
|
-
* });
|
|
21
20
|
* @param path
|
|
22
21
|
* @param callback
|
|
23
22
|
*/
|
|
24
|
-
export declare function exists(path:
|
|
23
|
+
export declare function exists(path: PathLike, cb?: (exists: boolean) => unknown): void;
|
|
25
24
|
/**
|
|
26
25
|
* Asynchronous `stat`.
|
|
27
26
|
* @param path
|
|
28
27
|
* @param callback
|
|
29
28
|
*/
|
|
30
|
-
export declare function stat(path:
|
|
29
|
+
export declare function stat(path: PathLike, callback: TwoArgCallback<Stats>): void;
|
|
30
|
+
export declare function stat(path: PathLike, options: Node.StatOptions & {
|
|
31
|
+
bigint?: false;
|
|
32
|
+
}, callback: TwoArgCallback<Stats>): void;
|
|
33
|
+
export declare function stat(path: PathLike, options: Node.StatOptions & {
|
|
34
|
+
bigint: true;
|
|
35
|
+
}, callback: TwoArgCallback<BigIntStats>): void;
|
|
36
|
+
export declare function stat(path: PathLike, options: Node.StatOptions, callback: TwoArgCallback<Stats | BigIntStats>): void;
|
|
31
37
|
/**
|
|
32
38
|
* Asynchronous `lstat`.
|
|
33
39
|
* `lstat()` is identical to `stat()`, except that if path is a symbolic link,
|
|
@@ -35,21 +41,28 @@ export declare function stat(path: string, cb?: BFSCallback<Stats>): void;
|
|
|
35
41
|
* @param path
|
|
36
42
|
* @param callback
|
|
37
43
|
*/
|
|
38
|
-
export declare function lstat(path:
|
|
44
|
+
export declare function lstat(path: PathLike, callback: TwoArgCallback<Stats>): void;
|
|
45
|
+
export declare function lstat(path: PathLike, options: Node.StatOptions & {
|
|
46
|
+
bigint?: false;
|
|
47
|
+
}, callback: TwoArgCallback<Stats>): void;
|
|
48
|
+
export declare function lstat(path: PathLike, options: Node.StatOptions & {
|
|
49
|
+
bigint: true;
|
|
50
|
+
}, callback: TwoArgCallback<BigIntStats>): void;
|
|
51
|
+
export declare function lstat(path: PathLike, options: Node.StatOptions, callback: TwoArgCallback<Stats | BigIntStats>): void;
|
|
39
52
|
/**
|
|
40
53
|
* Asynchronous `truncate`.
|
|
41
54
|
* @param path
|
|
42
55
|
* @param len
|
|
43
56
|
* @param callback
|
|
44
57
|
*/
|
|
45
|
-
export declare function truncate(path:
|
|
46
|
-
export declare function truncate(path:
|
|
58
|
+
export declare function truncate(path: PathLike, cb?: NoArgCallback): void;
|
|
59
|
+
export declare function truncate(path: PathLike, len: number, cb?: NoArgCallback): void;
|
|
47
60
|
/**
|
|
48
61
|
* Asynchronous `unlink`.
|
|
49
62
|
* @param path
|
|
50
63
|
* @param callback
|
|
51
64
|
*/
|
|
52
|
-
export declare function unlink(path:
|
|
65
|
+
export declare function unlink(path: PathLike, cb?: NoArgCallback): void;
|
|
53
66
|
/**
|
|
54
67
|
* Asynchronous file open.
|
|
55
68
|
* Exclusive mode ensures that path is newly created.
|
|
@@ -75,80 +88,60 @@ export declare function unlink(path: string, cb?: BFSOneArgCallback): void;
|
|
|
75
88
|
* @param mode defaults to `0644`
|
|
76
89
|
* @param callback
|
|
77
90
|
*/
|
|
78
|
-
export declare function open(path:
|
|
79
|
-
export declare function open(path:
|
|
91
|
+
export declare function open(path: PathLike, flag: string, cb?: TwoArgCallback<number>): void;
|
|
92
|
+
export declare function open(path: PathLike, flag: string, mode: number | string, cb?: TwoArgCallback<number>): void;
|
|
80
93
|
/**
|
|
81
94
|
* Asynchronously reads the entire contents of a file.
|
|
82
|
-
* @example Usage example
|
|
83
|
-
* fs.readFile('/etc/passwd', function (err, data) {
|
|
84
|
-
* if (err) throw err;
|
|
85
|
-
* console.log(data);
|
|
86
|
-
* });
|
|
87
95
|
* @param filename
|
|
88
96
|
* @param options
|
|
89
|
-
* @option options
|
|
90
|
-
* @option options
|
|
97
|
+
* @option options encoding The string encoding for the file contents. Defaults to `null`.
|
|
98
|
+
* @option options flag Defaults to `'r'`.
|
|
91
99
|
* @param callback If no encoding is specified, then the raw buffer is returned.
|
|
92
100
|
*/
|
|
93
|
-
export declare function readFile(filename:
|
|
94
|
-
export declare function readFile(filename:
|
|
101
|
+
export declare function readFile(filename: PathLike, cb: TwoArgCallback<Uint8Array>): void;
|
|
102
|
+
export declare function readFile(filename: PathLike, options: {
|
|
95
103
|
flag?: string;
|
|
96
|
-
}, callback?:
|
|
97
|
-
export declare function readFile(filename:
|
|
98
|
-
encoding:
|
|
104
|
+
}, callback?: TwoArgCallback<Uint8Array>): void;
|
|
105
|
+
export declare function readFile(filename: PathLike, optios: {
|
|
106
|
+
encoding: BufferEncoding;
|
|
99
107
|
flag?: string;
|
|
100
|
-
},
|
|
101
|
-
export declare function readFile(filename: string, encoding: string, cb: BFSCallback<string>): void;
|
|
108
|
+
} | BufferEncoding, cb: TwoArgCallback<string>): void;
|
|
102
109
|
/**
|
|
103
110
|
* Asynchronously writes data to a file, replacing the file if it already
|
|
104
111
|
* exists.
|
|
105
112
|
*
|
|
106
113
|
* The encoding option is ignored if data is a buffer.
|
|
107
114
|
*
|
|
108
|
-
* @example Usage example
|
|
109
|
-
* fs.writeFile('message.txt', 'Hello Node', function (err) {
|
|
110
|
-
* if (err) throw err;
|
|
111
|
-
* console.log('It\'s saved!');
|
|
112
|
-
* });
|
|
113
115
|
* @param filename
|
|
114
116
|
* @param data
|
|
115
117
|
* @param options
|
|
116
|
-
* @option
|
|
117
|
-
* @option
|
|
118
|
-
* @option
|
|
118
|
+
* @option encoding Defaults to `'utf8'`.
|
|
119
|
+
* @option mode Defaults to `0644`.
|
|
120
|
+
* @option flag Defaults to `'w'`.
|
|
119
121
|
* @param callback
|
|
120
122
|
*/
|
|
121
|
-
export declare function writeFile(filename:
|
|
122
|
-
export declare function writeFile(filename:
|
|
123
|
-
export declare function writeFile(filename:
|
|
124
|
-
encoding?: string;
|
|
125
|
-
mode?: string | number;
|
|
126
|
-
flag?: string;
|
|
127
|
-
}, cb?: BFSOneArgCallback): void;
|
|
123
|
+
export declare function writeFile(filename: PathLike, data: FileContents, cb?: NoArgCallback): void;
|
|
124
|
+
export declare function writeFile(filename: PathLike, data: FileContents, encoding?: BufferEncoding, cb?: NoArgCallback): void;
|
|
125
|
+
export declare function writeFile(filename: PathLike, data: FileContents, options?: Node.WriteFileOptions, cb?: NoArgCallback): void;
|
|
128
126
|
/**
|
|
129
127
|
* Asynchronously append data to a file, creating the file if it not yet
|
|
130
128
|
* exists.
|
|
131
129
|
*
|
|
132
|
-
* @example Usage example
|
|
133
|
-
* fs.appendFile('message.txt', 'data to append', function (err) {
|
|
134
|
-
* if (err) throw err;
|
|
135
|
-
* console.log('The "data to append" was appended to file!');
|
|
136
|
-
* });
|
|
137
130
|
* @param filename
|
|
138
131
|
* @param data
|
|
139
132
|
* @param options
|
|
140
|
-
* @option
|
|
141
|
-
* @option
|
|
142
|
-
* @option
|
|
133
|
+
* @option encoding Defaults to `'utf8'`.
|
|
134
|
+
* @option mode Defaults to `0644`.
|
|
135
|
+
* @option flag Defaults to `'a'`.
|
|
143
136
|
* @param callback
|
|
144
137
|
*/
|
|
145
|
-
export declare function appendFile(filename:
|
|
146
|
-
export declare function appendFile(filename:
|
|
138
|
+
export declare function appendFile(filename: PathLike, data: FileContents, cb?: NoArgCallback): void;
|
|
139
|
+
export declare function appendFile(filename: PathLike, data: FileContents, options?: {
|
|
147
140
|
encoding?: string;
|
|
148
141
|
mode?: number | string;
|
|
149
142
|
flag?: string;
|
|
150
|
-
}, cb?:
|
|
151
|
-
export declare function appendFile(filename:
|
|
143
|
+
}, cb?: NoArgCallback): void;
|
|
144
|
+
export declare function appendFile(filename: PathLike, data: FileContents, encoding?: string, cb?: NoArgCallback): void;
|
|
152
145
|
/**
|
|
153
146
|
* Asynchronous `fstat`.
|
|
154
147
|
* `fstat()` is identical to `stat()`, except that the file to be stat-ed is
|
|
@@ -156,33 +149,39 @@ export declare function appendFile(filename: string, data: FileContents, encodin
|
|
|
156
149
|
* @param fd
|
|
157
150
|
* @param callback
|
|
158
151
|
*/
|
|
159
|
-
export declare function fstat(fd: number, cb
|
|
152
|
+
export declare function fstat(fd: number, cb: TwoArgCallback<Stats>): void;
|
|
153
|
+
export declare function fstat(fd: number, options: Node.StatOptions & {
|
|
154
|
+
bigint?: false;
|
|
155
|
+
}, cb: TwoArgCallback<Stats>): void;
|
|
156
|
+
export declare function fstat(fd: number, options: Node.StatOptions & {
|
|
157
|
+
bigint: true;
|
|
158
|
+
}, cb: TwoArgCallback<BigIntStats>): void;
|
|
160
159
|
/**
|
|
161
160
|
* Asynchronous close.
|
|
162
161
|
* @param fd
|
|
163
162
|
* @param callback
|
|
164
163
|
*/
|
|
165
|
-
export declare function close(fd: number, cb?:
|
|
164
|
+
export declare function close(fd: number, cb?: NoArgCallback): void;
|
|
166
165
|
/**
|
|
167
166
|
* Asynchronous ftruncate.
|
|
168
167
|
* @param fd
|
|
169
168
|
* @param len
|
|
170
169
|
* @param callback
|
|
171
170
|
*/
|
|
172
|
-
export declare function ftruncate(fd: number, cb?:
|
|
173
|
-
export declare function ftruncate(fd: number, len?: number, cb?:
|
|
171
|
+
export declare function ftruncate(fd: number, cb?: NoArgCallback): void;
|
|
172
|
+
export declare function ftruncate(fd: number, len?: number, cb?: NoArgCallback): void;
|
|
174
173
|
/**
|
|
175
174
|
* Asynchronous fsync.
|
|
176
175
|
* @param fd
|
|
177
176
|
* @param callback
|
|
178
177
|
*/
|
|
179
|
-
export declare function fsync(fd: number, cb?:
|
|
178
|
+
export declare function fsync(fd: number, cb?: NoArgCallback): void;
|
|
180
179
|
/**
|
|
181
180
|
* Asynchronous fdatasync.
|
|
182
181
|
* @param fd
|
|
183
182
|
* @param callback
|
|
184
183
|
*/
|
|
185
|
-
export declare function fdatasync(fd: number, cb?:
|
|
184
|
+
export declare function fdatasync(fd: number, cb?: NoArgCallback): void;
|
|
186
185
|
/**
|
|
187
186
|
* Write buffer to the file specified by `fd`.
|
|
188
187
|
* Note that it is unsafe to use fs.write multiple times on the same file
|
|
@@ -197,11 +196,11 @@ export declare function fdatasync(fd: number, cb?: BFSOneArgCallback): void;
|
|
|
197
196
|
* the current position.
|
|
198
197
|
* @param callback The number specifies the number of bytes written into the file.
|
|
199
198
|
*/
|
|
200
|
-
export declare function write(fd: number, buffer: Uint8Array, offset: number, length: number, cb?:
|
|
201
|
-
export declare function write(fd: number, buffer: Uint8Array, offset: number, length: number, position: number | null, cb?:
|
|
202
|
-
export declare function write(fd: number, data: FileContents, cb?:
|
|
203
|
-
export declare function write(fd: number, data: FileContents, position: number | null, cb?:
|
|
204
|
-
export declare function write(fd: number, data: FileContents, position: number | null, encoding: BufferEncoding, cb?:
|
|
199
|
+
export declare function write(fd: number, buffer: Uint8Array, offset: number, length: number, cb?: ThreeArgCallback<number, Uint8Array>): void;
|
|
200
|
+
export declare function write(fd: number, buffer: Uint8Array, offset: number, length: number, position: number | null, cb?: ThreeArgCallback<number, Uint8Array>): void;
|
|
201
|
+
export declare function write(fd: number, data: FileContents, cb?: ThreeArgCallback<number, string>): void;
|
|
202
|
+
export declare function write(fd: number, data: FileContents, position: number | null, cb?: ThreeArgCallback<number, string>): void;
|
|
203
|
+
export declare function write(fd: number, data: FileContents, position: number | null, encoding: BufferEncoding, cb?: ThreeArgCallback<number, string>): void;
|
|
205
204
|
/**
|
|
206
205
|
* Read data from the file specified by `fd`.
|
|
207
206
|
* @param buffer The buffer that the data will be
|
|
@@ -214,7 +213,7 @@ export declare function write(fd: number, data: FileContents, position: number |
|
|
|
214
213
|
* position.
|
|
215
214
|
* @param callback The number is the number of bytes read
|
|
216
215
|
*/
|
|
217
|
-
export declare function read(fd: number, buffer: Uint8Array, offset: number, length: number, position?: number, cb?:
|
|
216
|
+
export declare function read(fd: number, buffer: Uint8Array, offset: number, length: number, position?: number, cb?: ThreeArgCallback<number, Uint8Array>): void;
|
|
218
217
|
/**
|
|
219
218
|
* Asynchronous `fchown`.
|
|
220
219
|
* @param fd
|
|
@@ -222,14 +221,14 @@ export declare function read(fd: number, buffer: Uint8Array, offset: number, len
|
|
|
222
221
|
* @param gid
|
|
223
222
|
* @param callback
|
|
224
223
|
*/
|
|
225
|
-
export declare function fchown(fd: number, uid: number, gid: number, cb?:
|
|
224
|
+
export declare function fchown(fd: number, uid: number, gid: number, cb?: NoArgCallback): void;
|
|
226
225
|
/**
|
|
227
226
|
* Asynchronous `fchmod`.
|
|
228
227
|
* @param fd
|
|
229
228
|
* @param mode
|
|
230
229
|
* @param callback
|
|
231
230
|
*/
|
|
232
|
-
export declare function fchmod(fd: number, mode: string | number, cb:
|
|
231
|
+
export declare function fchmod(fd: number, mode: string | number, cb: NoArgCallback): void;
|
|
233
232
|
/**
|
|
234
233
|
* Change the file timestamps of a file referenced by the supplied file
|
|
235
234
|
* descriptor.
|
|
@@ -238,20 +237,20 @@ export declare function fchmod(fd: number, mode: string | number, cb: BFSOneArgC
|
|
|
238
237
|
* @param mtime
|
|
239
238
|
* @param callback
|
|
240
239
|
*/
|
|
241
|
-
export declare function futimes(fd: number, atime: number | Date, mtime: number | Date, cb?:
|
|
240
|
+
export declare function futimes(fd: number, atime: number | Date, mtime: number | Date, cb?: NoArgCallback): void;
|
|
242
241
|
/**
|
|
243
242
|
* Asynchronous `rmdir`.
|
|
244
243
|
* @param path
|
|
245
244
|
* @param callback
|
|
246
245
|
*/
|
|
247
|
-
export declare function rmdir(path:
|
|
246
|
+
export declare function rmdir(path: PathLike, cb?: NoArgCallback): void;
|
|
248
247
|
/**
|
|
249
248
|
* Asynchronous `mkdir`.
|
|
250
249
|
* @param path
|
|
251
250
|
* @param mode defaults to `0777`
|
|
252
251
|
* @param callback
|
|
253
252
|
*/
|
|
254
|
-
export declare function mkdir(path:
|
|
253
|
+
export declare function mkdir(path: PathLike, mode?: Node.Mode, cb?: NoArgCallback): void;
|
|
255
254
|
/**
|
|
256
255
|
* Asynchronous `readdir`. Reads the contents of a directory.
|
|
257
256
|
* The callback gets two arguments `(err, files)` where `files` is an array of
|
|
@@ -259,29 +258,38 @@ export declare function mkdir(path: string, mode?: any, cb?: BFSOneArgCallback):
|
|
|
259
258
|
* @param path
|
|
260
259
|
* @param callback
|
|
261
260
|
*/
|
|
262
|
-
export declare function readdir(path:
|
|
261
|
+
export declare function readdir(path: PathLike, cb: TwoArgCallback<string[]>): void;
|
|
262
|
+
export declare function readdir(path: PathLike, options: {
|
|
263
|
+
withFileTypes?: false;
|
|
264
|
+
}, cb: TwoArgCallback<string[]>): void;
|
|
265
|
+
export declare function readdir(path: PathLike, options: {
|
|
266
|
+
withFileTypes: true;
|
|
267
|
+
}, cb: TwoArgCallback<Dirent[]>): void;
|
|
263
268
|
/**
|
|
264
269
|
* Asynchronous `link`.
|
|
265
|
-
* @param
|
|
266
|
-
* @param
|
|
270
|
+
* @param existing
|
|
271
|
+
* @param newpath
|
|
267
272
|
* @param callback
|
|
268
273
|
*/
|
|
269
|
-
export declare function link(
|
|
274
|
+
export declare function link(existing: PathLike, newpath: PathLike, cb?: NoArgCallback): void;
|
|
270
275
|
/**
|
|
271
276
|
* Asynchronous `symlink`.
|
|
272
|
-
* @param
|
|
273
|
-
* @param
|
|
277
|
+
* @param target target path
|
|
278
|
+
* @param path link path
|
|
274
279
|
* @param type can be either `'dir'` or `'file'` (default is `'file'`)
|
|
275
280
|
* @param callback
|
|
276
281
|
*/
|
|
277
|
-
export declare function symlink(
|
|
278
|
-
export declare function symlink(
|
|
282
|
+
export declare function symlink(target: PathLike, path: PathLike, cb?: NoArgCallback): void;
|
|
283
|
+
export declare function symlink(target: PathLike, path: PathLike, type?: Node.symlink.Type, cb?: NoArgCallback): void;
|
|
279
284
|
/**
|
|
280
285
|
* Asynchronous readlink.
|
|
281
286
|
* @param path
|
|
282
287
|
* @param callback
|
|
283
288
|
*/
|
|
284
|
-
export declare function readlink(path:
|
|
289
|
+
export declare function readlink(path: PathLike, callback: TwoArgCallback<string> & any): void;
|
|
290
|
+
export declare function readlink(path: PathLike, options: Node.BufferEncodingOption, callback: TwoArgCallback<Uint8Array>): void;
|
|
291
|
+
export declare function readlink(path: PathLike, options: Node.BaseEncodingOptions | string, callback: TwoArgCallback<string | Uint8Array>): void;
|
|
292
|
+
export declare function readlink(path: PathLike, options: Node.BaseEncodingOptions | BufferEncoding, callback: TwoArgCallback<string>): void;
|
|
285
293
|
/**
|
|
286
294
|
* Asynchronous `chown`.
|
|
287
295
|
* @param path
|
|
@@ -289,7 +297,7 @@ export declare function readlink(path: string, cb?: BFSCallback<string>): void;
|
|
|
289
297
|
* @param gid
|
|
290
298
|
* @param callback
|
|
291
299
|
*/
|
|
292
|
-
export declare function chown(path:
|
|
300
|
+
export declare function chown(path: PathLike, uid: number, gid: number, cb?: NoArgCallback): void;
|
|
293
301
|
/**
|
|
294
302
|
* Asynchronous `lchown`.
|
|
295
303
|
* @param path
|
|
@@ -297,21 +305,21 @@ export declare function chown(path: string, uid: number, gid: number, cb?: BFSOn
|
|
|
297
305
|
* @param gid
|
|
298
306
|
* @param callback
|
|
299
307
|
*/
|
|
300
|
-
export declare function lchown(path:
|
|
308
|
+
export declare function lchown(path: PathLike, uid: number, gid: number, cb?: NoArgCallback): void;
|
|
301
309
|
/**
|
|
302
310
|
* Asynchronous `chmod`.
|
|
303
311
|
* @param path
|
|
304
312
|
* @param mode
|
|
305
313
|
* @param callback
|
|
306
314
|
*/
|
|
307
|
-
export declare function chmod(path:
|
|
315
|
+
export declare function chmod(path: PathLike, mode: number | string, cb?: NoArgCallback): void;
|
|
308
316
|
/**
|
|
309
317
|
* Asynchronous `lchmod`.
|
|
310
318
|
* @param path
|
|
311
319
|
* @param mode
|
|
312
320
|
* @param callback
|
|
313
321
|
*/
|
|
314
|
-
export declare function lchmod(path:
|
|
322
|
+
export declare function lchmod(path: PathLike, mode: number | string, cb?: NoArgCallback): void;
|
|
315
323
|
/**
|
|
316
324
|
* Change file timestamps of the file referenced by the supplied path.
|
|
317
325
|
* @param path
|
|
@@ -319,7 +327,7 @@ export declare function lchmod(path: string, mode: number | string, cb?: BFSOneA
|
|
|
319
327
|
* @param mtime
|
|
320
328
|
* @param callback
|
|
321
329
|
*/
|
|
322
|
-
export declare function utimes(path:
|
|
330
|
+
export declare function utimes(path: PathLike, atime: number | Date, mtime: number | Date, cb?: NoArgCallback): void;
|
|
323
331
|
/**
|
|
324
332
|
* Change file timestamps of the file referenced by the supplied path.
|
|
325
333
|
* @param path
|
|
@@ -327,56 +335,54 @@ export declare function utimes(path: string, atime: number | Date, mtime: number
|
|
|
327
335
|
* @param mtime
|
|
328
336
|
* @param callback
|
|
329
337
|
*/
|
|
330
|
-
export declare function lutimes(path:
|
|
338
|
+
export declare function lutimes(path: PathLike, atime: number | Date, mtime: number | Date, cb?: NoArgCallback): void;
|
|
331
339
|
/**
|
|
332
340
|
* Asynchronous `realpath`. The callback gets two arguments
|
|
333
341
|
* `(err, resolvedPath)`. May use `process.cwd` to resolve relative paths.
|
|
334
342
|
*
|
|
335
|
-
* @example Usage example
|
|
336
|
-
* let cache = {'/etc':'/private/etc'};
|
|
337
|
-
* fs.realpath('/etc/passwd', cache, function (err, resolvedPath) {
|
|
338
|
-
* if (err) throw err;
|
|
339
|
-
* console.log(resolvedPath);
|
|
340
|
-
* });
|
|
341
|
-
*
|
|
342
343
|
* @param path
|
|
343
|
-
* @param cache An object literal of mapped paths that can be used to
|
|
344
|
-
* force a specific path resolution or avoid additional `fs.stat` calls for
|
|
345
|
-
* known real paths.
|
|
346
344
|
* @param callback
|
|
347
345
|
*/
|
|
348
|
-
export declare function realpath(path:
|
|
349
|
-
export declare function realpath(path:
|
|
350
|
-
[path: string]: string;
|
|
351
|
-
}, cb: BFSCallback<string>): void;
|
|
346
|
+
export declare function realpath(path: PathLike, cb?: TwoArgCallback<string>): void;
|
|
347
|
+
export declare function realpath(path: PathLike, options: Node.BaseEncodingOptions, cb: TwoArgCallback<string>): void;
|
|
352
348
|
/**
|
|
353
349
|
* Asynchronous `access`.
|
|
354
350
|
* @param path
|
|
355
351
|
* @param mode
|
|
356
352
|
* @param callback
|
|
357
353
|
*/
|
|
358
|
-
export declare function access(path:
|
|
359
|
-
export declare function access(path:
|
|
360
|
-
export declare function watchFile(filename:
|
|
361
|
-
export declare function watchFile(filename:
|
|
354
|
+
export declare function access(path: PathLike, cb: NoArgCallback): void;
|
|
355
|
+
export declare function access(path: PathLike, mode: number, cb: NoArgCallback): void;
|
|
356
|
+
export declare function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;
|
|
357
|
+
export declare function watchFile(filename: PathLike, options: {
|
|
362
358
|
persistent?: boolean;
|
|
363
359
|
interval?: number;
|
|
364
360
|
}, listener: (curr: Stats, prev: Stats) => void): void;
|
|
365
|
-
export declare function unwatchFile(filename:
|
|
366
|
-
export declare function watch(filename:
|
|
367
|
-
export declare function watch(filename:
|
|
361
|
+
export declare function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
|
|
362
|
+
export declare function watch(filename: PathLike, listener?: (event: string, filename: string) => any): Node.FSWatcher;
|
|
363
|
+
export declare function watch(filename: PathLike, options: {
|
|
368
364
|
persistent?: boolean;
|
|
369
|
-
}, listener?: (event: string, filename: string) => any): FSWatcher;
|
|
370
|
-
export declare function createReadStream(path:
|
|
365
|
+
}, listener?: (event: string, filename: string) => any): Node.FSWatcher;
|
|
366
|
+
export declare function createReadStream(path: PathLike, options?: {
|
|
371
367
|
flags?: string;
|
|
372
368
|
encoding?: string;
|
|
373
369
|
fd?: number;
|
|
374
370
|
mode?: number;
|
|
375
371
|
autoClose?: boolean;
|
|
376
372
|
}): ReadStream;
|
|
377
|
-
export declare function createWriteStream(path:
|
|
373
|
+
export declare function createWriteStream(path: PathLike, options?: {
|
|
378
374
|
flags?: string;
|
|
379
375
|
encoding?: string;
|
|
380
376
|
fd?: number;
|
|
381
377
|
mode?: number;
|
|
382
378
|
}): WriteStream;
|
|
379
|
+
export declare function rm(path: PathLike): void;
|
|
380
|
+
export declare function mkdtemp(path: PathLike): void;
|
|
381
|
+
export declare function copyFile(src: PathLike, dest: PathLike, callback: NoArgCallback): void;
|
|
382
|
+
export declare function copyFile(src: PathLike, dest: PathLike, flags: number, callback: NoArgCallback): void;
|
|
383
|
+
export declare function readv(path: PathLike): void;
|
|
384
|
+
type writevCallback = ThreeArgCallback<number, Uint8Array[]>;
|
|
385
|
+
export declare function writev(fd: number, buffers: Uint8Array[], cb: writevCallback): void;
|
|
386
|
+
export declare function writev(fd: number, buffers: Uint8Array[], position: number, cb: writevCallback): void;
|
|
387
|
+
export declare function opendir(path: PathLike): void;
|
|
388
|
+
export {};
|