@zenfs/core 2.3.7 → 2.3.8
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/utils.d.ts +1 -1
- package/dist/vfs/async.js +42 -42
- package/dist/vfs/dir.js +2 -2
- package/dist/vfs/streams.d.ts +2 -2
- package/package.json +1 -1
package/dist/utils.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function decodeDirListing(data: Uint8Array): Record<string, numbe
|
|
|
16
16
|
* @hidden
|
|
17
17
|
*/
|
|
18
18
|
export declare function encodeDirListing(data: Record<string, number>): Uint8Array;
|
|
19
|
-
export type Callback<Args extends unknown[] = [], NoError =
|
|
19
|
+
export type Callback<Args extends unknown[] = [], NoError = null> = (e: Exception | NoError, ...args: OptionalTuple<Args>) => unknown;
|
|
20
20
|
/**
|
|
21
21
|
* Normalizes a mode
|
|
22
22
|
* @param def default
|
package/dist/vfs/async.js
CHANGED
|
@@ -23,7 +23,7 @@ async function collectAsyncIterator(it) {
|
|
|
23
23
|
export function rename(oldPath, newPath, cb = nop) {
|
|
24
24
|
promises.rename
|
|
25
25
|
.call(this, oldPath, newPath)
|
|
26
|
-
.then(() => cb())
|
|
26
|
+
.then(() => cb(null))
|
|
27
27
|
.catch(cb);
|
|
28
28
|
}
|
|
29
29
|
rename;
|
|
@@ -43,7 +43,7 @@ export function stat(path, options, callback = nop) {
|
|
|
43
43
|
callback = typeof options == 'function' ? options : callback;
|
|
44
44
|
promises.stat
|
|
45
45
|
.call(this, path, typeof options != 'function' ? options : {})
|
|
46
|
-
.then(stats => callback(
|
|
46
|
+
.then(stats => callback(null, stats))
|
|
47
47
|
.catch(callback);
|
|
48
48
|
}
|
|
49
49
|
stat;
|
|
@@ -51,7 +51,7 @@ export function lstat(path, options, callback = nop) {
|
|
|
51
51
|
callback = typeof options == 'function' ? options : callback;
|
|
52
52
|
promises.lstat
|
|
53
53
|
.call(this, path, typeof options != 'function' ? options : {})
|
|
54
|
-
.then(stats => callback(
|
|
54
|
+
.then(stats => callback(null, stats))
|
|
55
55
|
.catch(callback);
|
|
56
56
|
}
|
|
57
57
|
lstat;
|
|
@@ -60,14 +60,14 @@ export function truncate(path, cbLen = 0, cb = nop) {
|
|
|
60
60
|
const len = typeof cbLen === 'number' ? cbLen : 0;
|
|
61
61
|
promises.truncate
|
|
62
62
|
.call(this, path, len)
|
|
63
|
-
.then(() => cb())
|
|
63
|
+
.then(() => cb(null))
|
|
64
64
|
.catch(cb);
|
|
65
65
|
}
|
|
66
66
|
truncate;
|
|
67
67
|
export function unlink(path, cb = nop) {
|
|
68
68
|
promises.unlink
|
|
69
69
|
.call(this, path)
|
|
70
|
-
.then(() => cb())
|
|
70
|
+
.then(() => cb(null))
|
|
71
71
|
.catch(cb);
|
|
72
72
|
}
|
|
73
73
|
unlink;
|
|
@@ -76,7 +76,7 @@ export function open(path, flag, cbMode, cb = nop) {
|
|
|
76
76
|
cb = typeof cbMode === 'function' ? cbMode : cb;
|
|
77
77
|
promises.open
|
|
78
78
|
.call(this, path, flag, mode)
|
|
79
|
-
.then(handle => cb(
|
|
79
|
+
.then(handle => cb(null, handle.fd))
|
|
80
80
|
.catch(cb);
|
|
81
81
|
}
|
|
82
82
|
open;
|
|
@@ -84,7 +84,7 @@ export function readFile(filename, options, cb = nop) {
|
|
|
84
84
|
cb = typeof options === 'function' ? options : cb;
|
|
85
85
|
promises.readFile
|
|
86
86
|
.call(this, filename, typeof options === 'function' ? null : options)
|
|
87
|
-
.then(data => cb(
|
|
87
|
+
.then(data => cb(null, data))
|
|
88
88
|
.catch(cb);
|
|
89
89
|
}
|
|
90
90
|
readFile;
|
|
@@ -92,7 +92,7 @@ export function writeFile(filename, data, cbEncOpts, cb = nop) {
|
|
|
92
92
|
cb = typeof cbEncOpts === 'function' ? cbEncOpts : cb;
|
|
93
93
|
promises.writeFile
|
|
94
94
|
.call(this, filename, data, typeof cbEncOpts != 'function' ? cbEncOpts : null)
|
|
95
|
-
.then(() => cb(
|
|
95
|
+
.then(() => cb(null))
|
|
96
96
|
.catch(cb);
|
|
97
97
|
}
|
|
98
98
|
writeFile;
|
|
@@ -101,7 +101,7 @@ export function appendFile(filename, data, cbEncOpts, cb = nop) {
|
|
|
101
101
|
cb = typeof cbEncOpts === 'function' ? cbEncOpts : cb;
|
|
102
102
|
promises.appendFile
|
|
103
103
|
.call(this, filename, data, optionsOrEncoding)
|
|
104
|
-
.then(() => cb())
|
|
104
|
+
.then(() => cb(null))
|
|
105
105
|
.catch(cb);
|
|
106
106
|
}
|
|
107
107
|
appendFile;
|
|
@@ -109,14 +109,14 @@ export function fstat(fd, options, cb = nop) {
|
|
|
109
109
|
cb = typeof options == 'function' ? options : cb;
|
|
110
110
|
new promises.FileHandle(this, fd)
|
|
111
111
|
.stat()
|
|
112
|
-
.then(stats => cb(
|
|
112
|
+
.then(stats => cb(null, typeof options == 'object' && options?.bigint ? new BigIntStats(stats) : stats))
|
|
113
113
|
.catch(cb);
|
|
114
114
|
}
|
|
115
115
|
fstat;
|
|
116
116
|
export function close(fd, cb = nop) {
|
|
117
117
|
new promises.FileHandle(this, fd)
|
|
118
118
|
.close()
|
|
119
|
-
.then(() => cb())
|
|
119
|
+
.then(() => cb(null))
|
|
120
120
|
.catch(cb);
|
|
121
121
|
}
|
|
122
122
|
close;
|
|
@@ -127,21 +127,21 @@ export function ftruncate(fd, lenOrCB, cb = nop) {
|
|
|
127
127
|
if (length < 0)
|
|
128
128
|
throw withErrno('EINVAL');
|
|
129
129
|
file.truncate(length)
|
|
130
|
-
.then(() => cb())
|
|
130
|
+
.then(() => cb(null))
|
|
131
131
|
.catch(cb);
|
|
132
132
|
}
|
|
133
133
|
ftruncate;
|
|
134
134
|
export function fsync(fd, cb = nop) {
|
|
135
135
|
new promises.FileHandle(this, fd)
|
|
136
136
|
.sync()
|
|
137
|
-
.then(() => cb())
|
|
137
|
+
.then(() => cb(null))
|
|
138
138
|
.catch(cb);
|
|
139
139
|
}
|
|
140
140
|
fsync;
|
|
141
141
|
export function fdatasync(fd, cb = nop) {
|
|
142
142
|
new promises.FileHandle(this, fd)
|
|
143
143
|
.datasync()
|
|
144
|
-
.then(() => cb())
|
|
144
|
+
.then(() => cb(null))
|
|
145
145
|
.catch(cb);
|
|
146
146
|
}
|
|
147
147
|
fdatasync;
|
|
@@ -174,7 +174,7 @@ export function write(fd, data, cbPosOff, cbLenEnc, cbPosEnc, cb = nop) {
|
|
|
174
174
|
const _cb = cb;
|
|
175
175
|
handle
|
|
176
176
|
.write(buffer, offset, length, position)
|
|
177
|
-
.then(({ bytesWritten }) => _cb(
|
|
177
|
+
.then(({ bytesWritten }) => _cb(null, bytesWritten, buffer.toString(encoding)))
|
|
178
178
|
.catch(_cb);
|
|
179
179
|
}
|
|
180
180
|
else {
|
|
@@ -186,7 +186,7 @@ export function write(fd, data, cbPosOff, cbLenEnc, cbPosEnc, cb = nop) {
|
|
|
186
186
|
const _cb = (typeof cbPosEnc === 'function' ? cbPosEnc : cb);
|
|
187
187
|
void handle
|
|
188
188
|
.write(buffer, offset, length, position)
|
|
189
|
-
.then(({ bytesWritten }) => _cb(
|
|
189
|
+
.then(({ bytesWritten }) => _cb(null, bytesWritten, buffer))
|
|
190
190
|
.catch(_cb);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
@@ -203,21 +203,21 @@ write;
|
|
|
203
203
|
export function read(fd, buffer, offset, length, position, cb = nop) {
|
|
204
204
|
new promises.FileHandle(this, fd)
|
|
205
205
|
.read(buffer, offset, length, position)
|
|
206
|
-
.then(({ bytesRead, buffer }) => cb(
|
|
206
|
+
.then(({ bytesRead, buffer }) => cb(null, bytesRead, buffer))
|
|
207
207
|
.catch(cb);
|
|
208
208
|
}
|
|
209
209
|
read;
|
|
210
210
|
export function fchown(fd, uid, gid, cb = nop) {
|
|
211
211
|
new promises.FileHandle(this, fd)
|
|
212
212
|
.chown(uid, gid)
|
|
213
|
-
.then(() => cb())
|
|
213
|
+
.then(() => cb(null))
|
|
214
214
|
.catch(cb);
|
|
215
215
|
}
|
|
216
216
|
fchown;
|
|
217
217
|
export function fchmod(fd, mode, cb) {
|
|
218
218
|
new promises.FileHandle(this, fd)
|
|
219
219
|
.chmod(mode)
|
|
220
|
-
.then(() => cb())
|
|
220
|
+
.then(() => cb(null))
|
|
221
221
|
.catch(cb);
|
|
222
222
|
}
|
|
223
223
|
fchmod;
|
|
@@ -227,14 +227,14 @@ fchmod;
|
|
|
227
227
|
export function futimes(fd, atime, mtime, cb = nop) {
|
|
228
228
|
new promises.FileHandle(this, fd)
|
|
229
229
|
.utimes(atime, mtime)
|
|
230
|
-
.then(() => cb())
|
|
230
|
+
.then(() => cb(null))
|
|
231
231
|
.catch(cb);
|
|
232
232
|
}
|
|
233
233
|
futimes;
|
|
234
234
|
export function rmdir(path, cb = nop) {
|
|
235
235
|
promises.rmdir
|
|
236
236
|
.call(this, path)
|
|
237
|
-
.then(() => cb())
|
|
237
|
+
.then(() => cb(null))
|
|
238
238
|
.catch(cb);
|
|
239
239
|
}
|
|
240
240
|
rmdir;
|
|
@@ -245,7 +245,7 @@ rmdir;
|
|
|
245
245
|
export function mkdir(path, mode, cb = nop) {
|
|
246
246
|
promises.mkdir
|
|
247
247
|
.call(this, path, mode)
|
|
248
|
-
.then(() => cb())
|
|
248
|
+
.then(() => cb(null))
|
|
249
249
|
.catch(cb);
|
|
250
250
|
}
|
|
251
251
|
mkdir;
|
|
@@ -254,14 +254,14 @@ export function readdir(path, _options, cb = nop) {
|
|
|
254
254
|
const options = typeof _options != 'function' ? _options : {};
|
|
255
255
|
promises.readdir
|
|
256
256
|
.call(this, path, options)
|
|
257
|
-
.then(entries => cb(
|
|
257
|
+
.then(entries => cb(null, entries))
|
|
258
258
|
.catch(cb);
|
|
259
259
|
}
|
|
260
260
|
readdir;
|
|
261
261
|
export function link(existing, newpath, cb = nop) {
|
|
262
262
|
promises.link
|
|
263
263
|
.call(this, existing, newpath)
|
|
264
|
-
.then(() => cb())
|
|
264
|
+
.then(() => cb(null))
|
|
265
265
|
.catch(cb);
|
|
266
266
|
}
|
|
267
267
|
link;
|
|
@@ -270,7 +270,7 @@ export function symlink(target, path, typeOrCB, cb = nop) {
|
|
|
270
270
|
cb = typeof typeOrCB === 'function' ? typeOrCB : cb;
|
|
271
271
|
promises.symlink
|
|
272
272
|
.call(this, target, path, type)
|
|
273
|
-
.then(() => cb())
|
|
273
|
+
.then(() => cb(null))
|
|
274
274
|
.catch(cb);
|
|
275
275
|
}
|
|
276
276
|
symlink;
|
|
@@ -278,35 +278,35 @@ export function readlink(path, options, callback = nop) {
|
|
|
278
278
|
callback = typeof options == 'function' ? options : callback;
|
|
279
279
|
promises.readlink
|
|
280
280
|
.call(this, path)
|
|
281
|
-
.then(result => callback(
|
|
281
|
+
.then(result => callback(null, result))
|
|
282
282
|
.catch(callback);
|
|
283
283
|
}
|
|
284
284
|
readlink;
|
|
285
285
|
export function chown(path, uid, gid, cb = nop) {
|
|
286
286
|
promises.chown
|
|
287
287
|
.call(this, path, uid, gid)
|
|
288
|
-
.then(() => cb())
|
|
288
|
+
.then(() => cb(null))
|
|
289
289
|
.catch(cb);
|
|
290
290
|
}
|
|
291
291
|
chown;
|
|
292
292
|
export function lchown(path, uid, gid, cb = nop) {
|
|
293
293
|
promises.lchown
|
|
294
294
|
.call(this, path, uid, gid)
|
|
295
|
-
.then(() => cb())
|
|
295
|
+
.then(() => cb(null))
|
|
296
296
|
.catch(cb);
|
|
297
297
|
}
|
|
298
298
|
lchown;
|
|
299
299
|
export function chmod(path, mode, cb = nop) {
|
|
300
300
|
promises.chmod
|
|
301
301
|
.call(this, path, mode)
|
|
302
|
-
.then(() => cb())
|
|
302
|
+
.then(() => cb(null))
|
|
303
303
|
.catch(cb);
|
|
304
304
|
}
|
|
305
305
|
chmod;
|
|
306
306
|
export function lchmod(path, mode, cb = nop) {
|
|
307
307
|
promises.lchmod
|
|
308
308
|
.call(this, path, mode)
|
|
309
|
-
.then(() => cb())
|
|
309
|
+
.then(() => cb(null))
|
|
310
310
|
.catch(cb);
|
|
311
311
|
}
|
|
312
312
|
lchmod;
|
|
@@ -316,7 +316,7 @@ lchmod;
|
|
|
316
316
|
export function utimes(path, atime, mtime, cb = nop) {
|
|
317
317
|
promises.utimes
|
|
318
318
|
.call(this, path, atime, mtime)
|
|
319
|
-
.then(() => cb())
|
|
319
|
+
.then(() => cb(null))
|
|
320
320
|
.catch(cb);
|
|
321
321
|
}
|
|
322
322
|
utimes;
|
|
@@ -326,7 +326,7 @@ utimes;
|
|
|
326
326
|
export function lutimes(path, atime, mtime, cb = nop) {
|
|
327
327
|
promises.lutimes
|
|
328
328
|
.call(this, path, atime, mtime)
|
|
329
|
-
.then(() => cb())
|
|
329
|
+
.then(() => cb(null))
|
|
330
330
|
.catch(cb);
|
|
331
331
|
}
|
|
332
332
|
lutimes;
|
|
@@ -334,7 +334,7 @@ export function realpath(path, arg2, cb = nop) {
|
|
|
334
334
|
cb = typeof arg2 === 'function' ? arg2 : cb;
|
|
335
335
|
promises.realpath
|
|
336
336
|
.call(this, path, typeof arg2 === 'function' ? null : arg2)
|
|
337
|
-
.then(result => cb(
|
|
337
|
+
.then(result => cb(null, result))
|
|
338
338
|
.catch(cb);
|
|
339
339
|
}
|
|
340
340
|
realpath;
|
|
@@ -343,7 +343,7 @@ export function access(path, cbMode, cb = nop) {
|
|
|
343
343
|
cb = typeof cbMode === 'function' ? cbMode : cb;
|
|
344
344
|
promises.access
|
|
345
345
|
.call(this, path, mode)
|
|
346
|
-
.then(() => cb())
|
|
346
|
+
.then(() => cb(null))
|
|
347
347
|
.catch(cb);
|
|
348
348
|
}
|
|
349
349
|
access;
|
|
@@ -441,7 +441,7 @@ export function rm(path, options, callback = nop) {
|
|
|
441
441
|
callback = typeof options === 'function' ? options : callback;
|
|
442
442
|
promises.rm
|
|
443
443
|
.call(this, path, typeof options === 'function' ? undefined : options)
|
|
444
|
-
.then(() => callback(
|
|
444
|
+
.then(() => callback(null))
|
|
445
445
|
.catch(callback);
|
|
446
446
|
}
|
|
447
447
|
rm;
|
|
@@ -449,7 +449,7 @@ export function mkdtemp(prefix, options, callback = nop) {
|
|
|
449
449
|
callback = typeof options === 'function' ? options : callback;
|
|
450
450
|
promises.mkdtemp
|
|
451
451
|
.call(this, prefix, typeof options != 'function' ? options : null)
|
|
452
|
-
.then(result => callback(
|
|
452
|
+
.then(result => callback(null, result))
|
|
453
453
|
.catch(callback);
|
|
454
454
|
}
|
|
455
455
|
mkdtemp;
|
|
@@ -457,7 +457,7 @@ export function copyFile(src, dest, flags, callback = nop) {
|
|
|
457
457
|
callback = typeof flags === 'function' ? flags : callback;
|
|
458
458
|
promises.copyFile
|
|
459
459
|
.call(this, src, dest, typeof flags === 'function' ? undefined : flags)
|
|
460
|
-
.then(() => callback(
|
|
460
|
+
.then(() => callback(null))
|
|
461
461
|
.catch(callback);
|
|
462
462
|
}
|
|
463
463
|
copyFile;
|
|
@@ -465,7 +465,7 @@ export function readv(fd, buffers, position, cb = nop) {
|
|
|
465
465
|
cb = typeof position === 'function' ? position : cb;
|
|
466
466
|
new promises.FileHandle(this, fd)
|
|
467
467
|
.readv(buffers, typeof position === 'function' ? undefined : position)
|
|
468
|
-
.then(({ buffers, bytesRead }) => cb(
|
|
468
|
+
.then(({ buffers, bytesRead }) => cb(null, bytesRead, buffers))
|
|
469
469
|
.catch(cb);
|
|
470
470
|
}
|
|
471
471
|
readv;
|
|
@@ -473,7 +473,7 @@ export function writev(fd, buffers, position, cb = nop) {
|
|
|
473
473
|
cb = typeof position === 'function' ? position : cb;
|
|
474
474
|
new promises.FileHandle(this, fd)
|
|
475
475
|
.writev(buffers, typeof position === 'function' ? undefined : position)
|
|
476
|
-
.then(({ buffers, bytesWritten }) => cb(
|
|
476
|
+
.then(({ buffers, bytesWritten }) => cb(null, bytesWritten, buffers))
|
|
477
477
|
.catch(cb);
|
|
478
478
|
}
|
|
479
479
|
writev;
|
|
@@ -481,7 +481,7 @@ export function opendir(path, options, cb = nop) {
|
|
|
481
481
|
cb = typeof options === 'function' ? options : cb;
|
|
482
482
|
promises.opendir
|
|
483
483
|
.call(this, path, typeof options === 'function' ? undefined : options)
|
|
484
|
-
.then(result => cb(
|
|
484
|
+
.then(result => cb(null, result))
|
|
485
485
|
.catch(cb);
|
|
486
486
|
}
|
|
487
487
|
opendir;
|
|
@@ -489,7 +489,7 @@ export function cp(source, destination, opts, callback = nop) {
|
|
|
489
489
|
callback = typeof opts === 'function' ? opts : callback;
|
|
490
490
|
promises.cp
|
|
491
491
|
.call(this, source, destination, typeof opts === 'function' ? undefined : opts)
|
|
492
|
-
.then(() => callback(
|
|
492
|
+
.then(() => callback(null))
|
|
493
493
|
.catch(callback);
|
|
494
494
|
}
|
|
495
495
|
cp;
|
|
@@ -497,7 +497,7 @@ export function statfs(path, options, callback = nop) {
|
|
|
497
497
|
callback = typeof options === 'function' ? options : callback;
|
|
498
498
|
promises.statfs
|
|
499
499
|
.call(this, path, typeof options === 'function' ? undefined : options)
|
|
500
|
-
.then(result => callback(
|
|
500
|
+
.then(result => callback(null, result))
|
|
501
501
|
.catch(callback);
|
|
502
502
|
}
|
|
503
503
|
statfs;
|
package/dist/vfs/dir.js
CHANGED
|
@@ -201,7 +201,7 @@ export class Dir {
|
|
|
201
201
|
if (!cb) {
|
|
202
202
|
return Promise.resolve();
|
|
203
203
|
}
|
|
204
|
-
cb();
|
|
204
|
+
cb(null);
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
207
207
|
* Synchronously close the directory's underlying resource handle.
|
|
@@ -223,7 +223,7 @@ export class Dir {
|
|
|
223
223
|
if (!cb) {
|
|
224
224
|
return this._read();
|
|
225
225
|
}
|
|
226
|
-
void this._read().then(value => cb(
|
|
226
|
+
void this._read().then(value => cb(null, value));
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Synchronously read the next directory entry via `readdir(3)` as a `Dirent`.
|
package/dist/vfs/streams.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare class ReadStream extends Readable implements fs.ReadStream {
|
|
|
51
51
|
private ready;
|
|
52
52
|
constructor(opts: CreateReadStreamOptions | undefined, handleOrPromise: FileHandle | Promise<FileHandle>);
|
|
53
53
|
_read(): Promise<void>;
|
|
54
|
-
close(callback?: Callback<[void]
|
|
54
|
+
close(callback?: Callback<[void]>): void;
|
|
55
55
|
get path(): string;
|
|
56
56
|
get bytesRead(): number;
|
|
57
57
|
wrap(oldStream: NodeJS.ReadableStream): this;
|
|
@@ -68,7 +68,7 @@ export declare class WriteStream extends Writable implements fs.WriteStream {
|
|
|
68
68
|
constructor(opts: CreateWriteStreamOptions | undefined, handleOrPromise: FileHandle | Promise<FileHandle>);
|
|
69
69
|
_write(chunk: any, encoding: BufferEncoding | 'buffer', callback: (error?: Error | null) => void): Promise<void>;
|
|
70
70
|
_final(callback: (error?: Error | null) => void): Promise<void>;
|
|
71
|
-
close(callback?: Callback<[void]
|
|
71
|
+
close(callback?: Callback<[void]>): void;
|
|
72
72
|
get path(): string;
|
|
73
73
|
get bytesWritten(): number;
|
|
74
74
|
}
|