@zenfs/core 0.10.0 → 0.11.1

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.
Files changed (63) hide show
  1. package/dist/backends/Index.d.ts +3 -3
  2. package/dist/backends/Index.js +4 -4
  3. package/dist/backends/backend.d.ts +1 -2
  4. package/dist/backends/backend.js +0 -5
  5. package/dist/backends/{Fetch.d.ts → fetch.d.ts} +4 -4
  6. package/dist/backends/{Fetch.js → fetch.js} +6 -7
  7. package/dist/backends/{Locked.d.ts → locked.d.ts} +2 -2
  8. package/dist/backends/{Locked.js → locked.js} +4 -5
  9. package/dist/backends/{InMemory.d.ts → memory.d.ts} +7 -9
  10. package/dist/backends/memory.js +38 -0
  11. package/dist/backends/{Overlay.d.ts → overlay.d.ts} +12 -13
  12. package/dist/backends/{Overlay.js → overlay.js} +98 -103
  13. package/dist/backends/port/fs.d.ts +15 -16
  14. package/dist/backends/port/fs.js +20 -22
  15. package/dist/backends/store/fs.d.ts +169 -0
  16. package/dist/backends/store/fs.js +743 -0
  17. package/dist/backends/store/simple.d.ts +64 -0
  18. package/dist/backends/store/simple.js +111 -0
  19. package/dist/backends/store/store.d.ts +111 -0
  20. package/dist/backends/store/store.js +62 -0
  21. package/dist/browser.min.js +4 -4
  22. package/dist/browser.min.js.map +4 -4
  23. package/dist/config.d.ts +1 -1
  24. package/dist/config.js +1 -1
  25. package/dist/emulation/shared.js +1 -1
  26. package/dist/error.d.ts +0 -1
  27. package/dist/error.js +0 -1
  28. package/dist/file.js +1 -1
  29. package/dist/filesystem.d.ts +3 -3
  30. package/dist/filesystem.js +26 -29
  31. package/dist/index.d.ts +7 -7
  32. package/dist/index.js +7 -7
  33. package/dist/inode.d.ts +1 -1
  34. package/package.json +1 -1
  35. package/src/backends/Index.ts +4 -4
  36. package/src/backends/backend.ts +3 -7
  37. package/src/backends/{Fetch.ts → fetch.ts} +13 -14
  38. package/src/backends/{Locked.ts → locked.ts} +5 -6
  39. package/src/backends/memory.ts +44 -0
  40. package/src/backends/{Overlay.ts → overlay.ts} +99 -105
  41. package/src/backends/port/fs.ts +24 -26
  42. package/src/backends/store/fs.ts +881 -0
  43. package/src/backends/store/readme.md +9 -0
  44. package/src/backends/store/simple.ts +144 -0
  45. package/src/backends/store/store.ts +164 -0
  46. package/src/config.ts +3 -3
  47. package/src/emulation/shared.ts +1 -1
  48. package/src/error.ts +0 -1
  49. package/src/file.ts +1 -1
  50. package/src/filesystem.ts +29 -32
  51. package/src/index.ts +7 -7
  52. package/src/inode.ts +1 -1
  53. package/dist/backends/AsyncStore.d.ts +0 -204
  54. package/dist/backends/AsyncStore.js +0 -509
  55. package/dist/backends/InMemory.js +0 -49
  56. package/dist/backends/SyncStore.d.ts +0 -213
  57. package/dist/backends/SyncStore.js +0 -445
  58. package/dist/backends/port/store.d.ts +0 -30
  59. package/dist/backends/port/store.js +0 -142
  60. package/src/backends/AsyncStore.ts +0 -655
  61. package/src/backends/InMemory.ts +0 -56
  62. package/src/backends/SyncStore.ts +0 -589
  63. package/src/backends/port/store.ts +0 -187
@@ -2,7 +2,7 @@ import { FileSystem } from '../filesystem.js';
2
2
  import { ErrnoError, Errno } from '../error.js';
3
3
  import { PreloadFile, parseFlag } from '../file.js';
4
4
  import { Stats } from '../stats.js';
5
- import { LockedFS } from './Locked.js';
5
+ import { LockedFS } from './locked.js';
6
6
  import { dirname } from '../emulation/path.js';
7
7
  import { rootCred } from '../cred.js';
8
8
  import { decode, encode } from '../utils.js';
@@ -23,7 +23,6 @@ export class UnlockedOverlayFS extends FileSystem {
23
23
  await this._readable.ready();
24
24
  await this._writable.ready();
25
25
  await this._ready;
26
- return this;
27
26
  }
28
27
  constructor({ writable, readable }) {
29
28
  super();
@@ -121,31 +120,31 @@ export class UnlockedOverlayFS extends FileSystem {
121
120
  }
122
121
  }
123
122
  }
124
- async stat(p, cred) {
123
+ async stat(path, cred) {
125
124
  this.checkInitialized();
126
125
  try {
127
- return this._writable.stat(p, cred);
126
+ return this._writable.stat(path, cred);
128
127
  }
129
128
  catch (e) {
130
- if (this._deletedFiles.has(p)) {
131
- throw ErrnoError.With('ENOENT', p, 'stat');
129
+ if (this._deletedFiles.has(path)) {
130
+ throw ErrnoError.With('ENOENT', path, 'stat');
132
131
  }
133
- const oldStat = new Stats(await this._readable.stat(p, cred));
132
+ const oldStat = new Stats(await this._readable.stat(path, cred));
134
133
  // Make the oldStat's mode writable. Preserve the topmost part of the mode, which specifies the type
135
134
  oldStat.mode |= 0o222;
136
135
  return oldStat;
137
136
  }
138
137
  }
139
- statSync(p, cred) {
138
+ statSync(path, cred) {
140
139
  this.checkInitialized();
141
140
  try {
142
- return this._writable.statSync(p, cred);
141
+ return this._writable.statSync(path, cred);
143
142
  }
144
143
  catch (e) {
145
- if (this._deletedFiles.has(p)) {
146
- throw ErrnoError.With('ENOENT', p, 'stat');
144
+ if (this._deletedFiles.has(path)) {
145
+ throw ErrnoError.With('ENOENT', path, 'stat');
147
146
  }
148
- const oldStat = new Stats(this._readable.statSync(p, cred));
147
+ const oldStat = new Stats(this._readable.statSync(path, cred));
149
148
  // Make the oldStat's mode writable. Preserve the topmost part of the mode, which specifies the type.
150
149
  oldStat.mode |= 0o222;
151
150
  return oldStat;
@@ -190,145 +189,145 @@ export class UnlockedOverlayFS extends FileSystem {
190
189
  this.checkInitialized();
191
190
  this._writable.linkSync(srcpath, dstpath, cred);
192
191
  }
193
- async unlink(p, cred) {
192
+ async unlink(path, cred) {
194
193
  this.checkInitialized();
195
- this.checkPath(p);
196
- if (!(await this.exists(p, cred))) {
197
- throw ErrnoError.With('ENOENT', p, 'unlink');
194
+ this.checkPath(path);
195
+ if (!(await this.exists(path, cred))) {
196
+ throw ErrnoError.With('ENOENT', path, 'unlink');
198
197
  }
199
- if (await this._writable.exists(p, cred)) {
200
- await this._writable.unlink(p, cred);
198
+ if (await this._writable.exists(path, cred)) {
199
+ await this._writable.unlink(path, cred);
201
200
  }
202
201
  // if it still exists add to the delete log
203
- if (await this.exists(p, cred)) {
204
- this.deletePath(p, cred);
202
+ if (await this.exists(path, cred)) {
203
+ this.deletePath(path, cred);
205
204
  }
206
205
  }
207
- unlinkSync(p, cred) {
206
+ unlinkSync(path, cred) {
208
207
  this.checkInitialized();
209
- this.checkPath(p);
210
- if (!this.existsSync(p, cred)) {
211
- throw ErrnoError.With('ENOENT', p, 'unlink');
208
+ this.checkPath(path);
209
+ if (!this.existsSync(path, cred)) {
210
+ throw ErrnoError.With('ENOENT', path, 'unlink');
212
211
  }
213
- if (this._writable.existsSync(p, cred)) {
214
- this._writable.unlinkSync(p, cred);
212
+ if (this._writable.existsSync(path, cred)) {
213
+ this._writable.unlinkSync(path, cred);
215
214
  }
216
215
  // if it still exists add to the delete log
217
- if (this.existsSync(p, cred)) {
218
- this.deletePath(p, cred);
216
+ if (this.existsSync(path, cred)) {
217
+ this.deletePath(path, cred);
219
218
  }
220
219
  }
221
- async rmdir(p, cred) {
220
+ async rmdir(path, cred) {
222
221
  this.checkInitialized();
223
- if (!(await this.exists(p, cred))) {
224
- throw ErrnoError.With('ENOENT', p, 'rmdir');
222
+ if (!(await this.exists(path, cred))) {
223
+ throw ErrnoError.With('ENOENT', path, 'rmdir');
225
224
  }
226
- if (await this._writable.exists(p, cred)) {
227
- await this._writable.rmdir(p, cred);
225
+ if (await this._writable.exists(path, cred)) {
226
+ await this._writable.rmdir(path, cred);
228
227
  }
229
- if (await this.exists(p, cred)) {
228
+ if (await this.exists(path, cred)) {
230
229
  // Check if directory is empty.
231
- if ((await this.readdir(p, cred)).length > 0) {
232
- throw ErrnoError.With('ENOTEMPTY', p, 'rmdir');
230
+ if ((await this.readdir(path, cred)).length > 0) {
231
+ throw ErrnoError.With('ENOTEMPTY', path, 'rmdir');
233
232
  }
234
233
  else {
235
- this.deletePath(p, cred);
234
+ this.deletePath(path, cred);
236
235
  }
237
236
  }
238
237
  }
239
- rmdirSync(p, cred) {
238
+ rmdirSync(path, cred) {
240
239
  this.checkInitialized();
241
- if (!this.existsSync(p, cred)) {
242
- throw ErrnoError.With('ENOENT', p, 'rmdir');
240
+ if (!this.existsSync(path, cred)) {
241
+ throw ErrnoError.With('ENOENT', path, 'rmdir');
243
242
  }
244
- if (this._writable.existsSync(p, cred)) {
245
- this._writable.rmdirSync(p, cred);
243
+ if (this._writable.existsSync(path, cred)) {
244
+ this._writable.rmdirSync(path, cred);
246
245
  }
247
- if (this.existsSync(p, cred)) {
246
+ if (this.existsSync(path, cred)) {
248
247
  // Check if directory is empty.
249
- if (this.readdirSync(p, cred).length > 0) {
250
- throw ErrnoError.With('ENOTEMPTY', p, 'rmdir');
248
+ if (this.readdirSync(path, cred).length > 0) {
249
+ throw ErrnoError.With('ENOTEMPTY', path, 'rmdir');
251
250
  }
252
251
  else {
253
- this.deletePath(p, cred);
252
+ this.deletePath(path, cred);
254
253
  }
255
254
  }
256
255
  }
257
- async mkdir(p, mode, cred) {
256
+ async mkdir(path, mode, cred) {
258
257
  this.checkInitialized();
259
- if (await this.exists(p, cred)) {
260
- throw ErrnoError.With('EEXIST', p, 'mkdir');
258
+ if (await this.exists(path, cred)) {
259
+ throw ErrnoError.With('EEXIST', path, 'mkdir');
261
260
  }
262
261
  // The below will throw should any of the parent directories fail to exist on _writable.
263
- await this.createParentDirectories(p, cred);
264
- await this._writable.mkdir(p, mode, cred);
262
+ await this.createParentDirectories(path, cred);
263
+ await this._writable.mkdir(path, mode, cred);
265
264
  }
266
- mkdirSync(p, mode, cred) {
265
+ mkdirSync(path, mode, cred) {
267
266
  this.checkInitialized();
268
- if (this.existsSync(p, cred)) {
269
- throw ErrnoError.With('EEXIST', p, 'mkdir');
267
+ if (this.existsSync(path, cred)) {
268
+ throw ErrnoError.With('EEXIST', path, 'mkdir');
270
269
  }
271
270
  // The below will throw should any of the parent directories fail to exist on _writable.
272
- this.createParentDirectoriesSync(p, cred);
273
- this._writable.mkdirSync(p, mode, cred);
271
+ this.createParentDirectoriesSync(path, cred);
272
+ this._writable.mkdirSync(path, mode, cred);
274
273
  }
275
- async readdir(p, cred) {
274
+ async readdir(path, cred) {
276
275
  this.checkInitialized();
277
- const dirStats = await this.stat(p, cred);
276
+ const dirStats = await this.stat(path, cred);
278
277
  if (!dirStats.isDirectory()) {
279
- throw ErrnoError.With('ENOTDIR', p, 'readdir');
278
+ throw ErrnoError.With('ENOTDIR', path, 'readdir');
280
279
  }
281
280
  // Readdir in both, check delete log on RO file system's listing, merge, return.
282
281
  const contents = [];
283
282
  try {
284
- contents.push(...(await this._writable.readdir(p, cred)));
283
+ contents.push(...(await this._writable.readdir(path, cred)));
285
284
  }
286
285
  catch (e) {
287
286
  // NOP.
288
287
  }
289
288
  try {
290
- contents.push(...(await this._readable.readdir(p, cred)).filter((fPath) => !this._deletedFiles.has(`${p}/${fPath}`)));
289
+ contents.push(...(await this._readable.readdir(path, cred)).filter((fPath) => !this._deletedFiles.has(`${path}/${fPath}`)));
291
290
  }
292
291
  catch (e) {
293
292
  // NOP.
294
293
  }
295
294
  const seenMap = {};
296
- return contents.filter((fileP) => {
297
- const result = !seenMap[fileP];
298
- seenMap[fileP] = true;
295
+ return contents.filter((path) => {
296
+ const result = !seenMap[path];
297
+ seenMap[path] = true;
299
298
  return result;
300
299
  });
301
300
  }
302
- readdirSync(p, cred) {
301
+ readdirSync(path, cred) {
303
302
  this.checkInitialized();
304
- const dirStats = this.statSync(p, cred);
303
+ const dirStats = this.statSync(path, cred);
305
304
  if (!dirStats.isDirectory()) {
306
- throw ErrnoError.With('ENOTDIR', p, 'readdir');
305
+ throw ErrnoError.With('ENOTDIR', path, 'readdir');
307
306
  }
308
307
  // Readdir in both, check delete log on RO file system's listing, merge, return.
309
308
  let contents = [];
310
309
  try {
311
- contents = contents.concat(this._writable.readdirSync(p, cred));
310
+ contents = contents.concat(this._writable.readdirSync(path, cred));
312
311
  }
313
312
  catch (e) {
314
313
  // NOP.
315
314
  }
316
315
  try {
317
- contents = contents.concat(this._readable.readdirSync(p, cred).filter((fPath) => !this._deletedFiles.has(`${p}/${fPath}`)));
316
+ contents = contents.concat(this._readable.readdirSync(path, cred).filter((fPath) => !this._deletedFiles.has(`${path}/${fPath}`)));
318
317
  }
319
318
  catch (e) {
320
319
  // NOP.
321
320
  }
322
321
  const seenMap = {};
323
- return contents.filter((fileP) => {
324
- const result = !seenMap[fileP];
325
- seenMap[fileP] = true;
322
+ return contents.filter((path) => {
323
+ const result = !seenMap[path];
324
+ seenMap[path] = true;
326
325
  return result;
327
326
  });
328
327
  }
329
- deletePath(p, cred) {
330
- this._deletedFiles.add(p);
331
- this.updateLog(`d${p}\n`, cred);
328
+ deletePath(path, cred) {
329
+ this._deletedFiles.add(path);
330
+ this.updateLog(`d${path}\n`, cred);
332
331
  }
333
332
  async updateLog(addition, cred) {
334
333
  this._deleteLog += addition;
@@ -382,8 +381,8 @@ export class UnlockedOverlayFS extends FileSystem {
382
381
  * With the given path, create the needed parent directories on the writable storage
383
382
  * should they not exist. Use modes from the read-only storage.
384
383
  */
385
- createParentDirectoriesSync(p, cred) {
386
- let parent = dirname(p), toCreate = [];
384
+ createParentDirectoriesSync(path, cred) {
385
+ let parent = dirname(path), toCreate = [];
387
386
  while (!this._writable.existsSync(parent, cred)) {
388
387
  toCreate.push(parent);
389
388
  parent = dirname(parent);
@@ -393,8 +392,8 @@ export class UnlockedOverlayFS extends FileSystem {
393
392
  this._writable.mkdirSync(p, this.statSync(p, cred).mode, cred);
394
393
  }
395
394
  }
396
- async createParentDirectories(p, cred) {
397
- let parent = dirname(p), toCreate = [];
395
+ async createParentDirectories(path, cred) {
396
+ let parent = dirname(path), toCreate = [];
398
397
  while (!(await this._writable.exists(parent, cred))) {
399
398
  toCreate.push(parent);
400
399
  parent = dirname(parent);
@@ -410,53 +409,53 @@ export class UnlockedOverlayFS extends FileSystem {
410
409
  * - Ensures p is on writable before proceeding. Throws an error if it doesn't exist.
411
410
  * - Calls f to perform operation on writable.
412
411
  */
413
- operateOnWritable(p, cred) {
414
- if (!this.existsSync(p, cred)) {
415
- throw ErrnoError.With('ENOENT', p, 'operateOnWriteable');
412
+ operateOnWritable(path, cred) {
413
+ if (!this.existsSync(path, cred)) {
414
+ throw ErrnoError.With('ENOENT', path, 'operateOnWriteable');
416
415
  }
417
- if (!this._writable.existsSync(p, cred)) {
416
+ if (!this._writable.existsSync(path, cred)) {
418
417
  // File is on readable storage. Copy to writable storage before
419
418
  // changing its mode.
420
- this.copyToWritableSync(p, cred);
419
+ this.copyToWritableSync(path, cred);
421
420
  }
422
421
  }
423
- async operateOnWritableAsync(p, cred) {
424
- if (!(await this.exists(p, cred))) {
425
- throw ErrnoError.With('ENOENT', p, 'operateOnWritable');
422
+ async operateOnWritableAsync(path, cred) {
423
+ if (!(await this.exists(path, cred))) {
424
+ throw ErrnoError.With('ENOENT', path, 'operateOnWritable');
426
425
  }
427
- if (!(await this._writable.exists(p, cred))) {
428
- return this.copyToWritable(p, cred);
426
+ if (!(await this._writable.exists(path, cred))) {
427
+ return this.copyToWritable(path, cred);
429
428
  }
430
429
  }
431
430
  /**
432
431
  * Copy from readable to writable storage.
433
432
  * PRECONDITION: File does not exist on writable storage.
434
433
  */
435
- copyToWritableSync(p, cred) {
436
- const stats = this.statSync(p, cred);
434
+ copyToWritableSync(path, cred) {
435
+ const stats = this.statSync(path, cred);
437
436
  if (stats.isDirectory()) {
438
- this._writable.mkdirSync(p, stats.mode, cred);
437
+ this._writable.mkdirSync(path, stats.mode, cred);
439
438
  return;
440
439
  }
441
440
  const data = new Uint8Array(stats.size);
442
- const readable = this._readable.openFileSync(p, parseFlag('r'), cred);
441
+ const readable = this._readable.openFileSync(path, parseFlag('r'), cred);
443
442
  readable.readSync(data);
444
443
  readable.closeSync();
445
- const writable = this._writable.openFileSync(p, parseFlag('w'), cred);
444
+ const writable = this._writable.openFileSync(path, parseFlag('w'), cred);
446
445
  writable.writeSync(data);
447
446
  writable.closeSync();
448
447
  }
449
- async copyToWritable(p, cred) {
450
- const stats = await this.stat(p, cred);
448
+ async copyToWritable(path, cred) {
449
+ const stats = await this.stat(path, cred);
451
450
  if (stats.isDirectory()) {
452
- await this._writable.mkdir(p, stats.mode, cred);
451
+ await this._writable.mkdir(path, stats.mode, cred);
453
452
  return;
454
453
  }
455
454
  const data = new Uint8Array(stats.size);
456
- const readable = await this._readable.openFile(p, parseFlag('r'), cred);
455
+ const readable = await this._readable.openFile(path, parseFlag('r'), cred);
457
456
  await readable.read(data);
458
457
  await readable.close();
459
- const writable = await this._writable.openFile(p, parseFlag('w'), cred);
458
+ const writable = await this._writable.openFile(path, parseFlag('w'), cred);
460
459
  await writable.write(data);
461
460
  await writable.close();
462
461
  }
@@ -468,10 +467,6 @@ export class UnlockedOverlayFS extends FileSystem {
468
467
  * @internal
469
468
  */
470
469
  export class OverlayFS extends LockedFS {
471
- async ready() {
472
- await super.ready();
473
- return this;
474
- }
475
470
  /**
476
471
  * @param options The options to initialize the OverlayFS with
477
472
  */
@@ -1,13 +1,12 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
+ import type { FileReadResult } from 'node:fs/promises';
4
+ import type { ExtractProperties } from 'utilium';
3
5
  import type { Cred } from '../../cred.js';
4
- import { FileSystem, type FileSystemMetadata } from '../../filesystem.js';
5
6
  import { File } from '../../file.js';
7
+ import { FileSystem, type FileSystemMetadata } from '../../filesystem.js';
6
8
  import { Stats, type FileType } from '../../stats.js';
7
- import type { SyncStoreFS } from '../SyncStore.js';
8
9
  import * as RPC from './rpc.js';
9
- import type { ExtractProperties } from 'utilium';
10
- import type { FileReadResult } from 'node:fs/promises';
11
10
  type FileMethods = ExtractProperties<File, (...args: any[]) => Promise<any>>;
12
11
  type FileMethod = keyof FileMethods;
13
12
  export declare class PortFile extends File {
@@ -44,7 +43,7 @@ declare const PortFS_base: (abstract new (...args: any[]) => {
44
43
  _sync: FileSystem;
45
44
  queueDone(): Promise<void>;
46
45
  metadata(): FileSystemMetadata;
47
- ready(): Promise<any>;
46
+ ready(): Promise<void>;
48
47
  renameSync(oldPath: string, newPath: string, cred: Cred): void;
49
48
  statSync(path: string, cred: Cred): Stats;
50
49
  createFileSync(path: string, flag: string, mode: number, cred: Cred): File;
@@ -80,7 +79,7 @@ export declare class PortFS extends PortFS_base {
80
79
  /**
81
80
  * @hidden
82
81
  */
83
- _sync: SyncStoreFS;
82
+ _sync: import("../store/fs.js").StoreFS;
84
83
  /**
85
84
  * Constructs a new PortFS instance that connects with ZenFS running on
86
85
  * the specified port.
@@ -88,17 +87,17 @@ export declare class PortFS extends PortFS_base {
88
87
  constructor(options: RPC.Options);
89
88
  metadata(): FileSystemMetadata;
90
89
  protected rpc<const T extends FSMethod>(method: T, ...args: Parameters<FSMethods[T]>): Promise<Awaited<ReturnType<FSMethods[T]>>>;
91
- ready(): Promise<this>;
90
+ ready(): Promise<void>;
92
91
  rename(oldPath: string, newPath: string, cred: Cred): Promise<void>;
93
- stat(p: string, cred: Cred): Promise<Stats>;
92
+ stat(path: string, cred: Cred): Promise<Stats>;
94
93
  sync(path: string, data: Uint8Array, stats: Readonly<Stats>): Promise<void>;
95
- openFile(p: string, flag: string, cred: Cred): Promise<File>;
96
- createFile(p: string, flag: string, mode: number, cred: Cred): Promise<File>;
97
- unlink(p: string, cred: Cred): Promise<void>;
98
- rmdir(p: string, cred: Cred): Promise<void>;
99
- mkdir(p: string, mode: number, cred: Cred): Promise<void>;
100
- readdir(p: string, cred: Cred): Promise<string[]>;
101
- exists(p: string, cred: Cred): Promise<boolean>;
94
+ openFile(path: string, flag: string, cred: Cred): Promise<File>;
95
+ createFile(path: string, flag: string, mode: number, cred: Cred): Promise<File>;
96
+ unlink(path: string, cred: Cred): Promise<void>;
97
+ rmdir(path: string, cred: Cred): Promise<void>;
98
+ mkdir(path: string, mode: number, cred: Cred): Promise<void>;
99
+ readdir(path: string, cred: Cred): Promise<string[]>;
100
+ exists(path: string, cred: Cred): Promise<boolean>;
102
101
  link(srcpath: string, dstpath: string, cred: Cred): Promise<void>;
103
102
  }
104
103
  export declare function attachFS(port: RPC.Port, fs: FileSystem): void;
@@ -118,7 +117,7 @@ export declare const Port: {
118
117
  description: string;
119
118
  };
120
119
  };
121
- isAvailable(port?: RPC.Port): Promise<boolean>;
120
+ isAvailable(): Promise<boolean>;
122
121
  create(options: RPC.Options): PortFS;
123
122
  };
124
123
  export {};
@@ -1,9 +1,8 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { ErrnoError, Errno } from '../../error.js';
3
- import { FileSystem, Async } from '../../filesystem.js';
1
+ import { Errno, ErrnoError } from '../../error.js';
4
2
  import { File } from '../../file.js';
3
+ import { Async, FileSystem } from '../../filesystem.js';
5
4
  import { Stats } from '../../stats.js';
6
- import { InMemory } from '../InMemory.js';
5
+ import { InMemory } from '../memory.js';
7
6
  import * as RPC from './rpc.js';
8
7
  export class PortFile extends File {
9
8
  constructor(fs, fd, path, position) {
@@ -119,37 +118,36 @@ export class PortFS extends Async(FileSystem) {
119
118
  async ready() {
120
119
  await this.rpc('ready');
121
120
  await super.ready();
122
- return this;
123
121
  }
124
122
  rename(oldPath, newPath, cred) {
125
123
  return this.rpc('rename', oldPath, newPath, cred);
126
124
  }
127
- async stat(p, cred) {
128
- return new Stats(await this.rpc('stat', p, cred));
125
+ async stat(path, cred) {
126
+ return new Stats(await this.rpc('stat', path, cred));
129
127
  }
130
128
  sync(path, data, stats) {
131
129
  return this.rpc('sync', path, data, stats);
132
130
  }
133
- openFile(p, flag, cred) {
134
- return this.rpc('openFile', p, flag, cred);
131
+ openFile(path, flag, cred) {
132
+ return this.rpc('openFile', path, flag, cred);
135
133
  }
136
- createFile(p, flag, mode, cred) {
137
- return this.rpc('createFile', p, flag, mode, cred);
134
+ createFile(path, flag, mode, cred) {
135
+ return this.rpc('createFile', path, flag, mode, cred);
138
136
  }
139
- unlink(p, cred) {
140
- return this.rpc('unlink', p, cred);
137
+ unlink(path, cred) {
138
+ return this.rpc('unlink', path, cred);
141
139
  }
142
- rmdir(p, cred) {
143
- return this.rpc('rmdir', p, cred);
140
+ rmdir(path, cred) {
141
+ return this.rpc('rmdir', path, cred);
144
142
  }
145
- mkdir(p, mode, cred) {
146
- return this.rpc('mkdir', p, mode, cred);
143
+ mkdir(path, mode, cred) {
144
+ return this.rpc('mkdir', path, mode, cred);
147
145
  }
148
- readdir(p, cred) {
149
- return this.rpc('readdir', p, cred);
146
+ readdir(path, cred) {
147
+ return this.rpc('readdir', path, cred);
150
148
  }
151
- exists(p, cred) {
152
- return this.rpc('exists', p, cred);
149
+ exists(path, cred) {
150
+ return this.rpc('exists', path, cred);
153
151
  }
154
152
  link(srcpath, dstpath, cred) {
155
153
  return this.rpc('link', srcpath, dstpath, cred);
@@ -232,7 +230,7 @@ export const Port = {
232
230
  description: 'How long to wait before the request times out',
233
231
  },
234
232
  },
235
- async isAvailable(port) {
233
+ async isAvailable() {
236
234
  return true;
237
235
  },
238
236
  create(options) {