@zenfs/core 2.0.0 → 2.1.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 (88) hide show
  1. package/dist/backends/backend.js +6 -5
  2. package/dist/backends/cow.d.ts +2 -2
  3. package/dist/backends/cow.js +39 -58
  4. package/dist/backends/fetch.js +27 -29
  5. package/dist/backends/passthrough.d.ts +2 -3
  6. package/dist/backends/passthrough.js +84 -199
  7. package/dist/backends/port.d.ts +16 -3
  8. package/dist/backends/port.js +61 -30
  9. package/dist/backends/single_buffer.d.ts +52 -46
  10. package/dist/backends/single_buffer.js +462 -219
  11. package/dist/backends/store/fs.d.ts +16 -10
  12. package/dist/backends/store/fs.js +227 -242
  13. package/dist/backends/store/store.d.ts +3 -3
  14. package/dist/backends/store/store.js +11 -10
  15. package/dist/config.d.ts +2 -2
  16. package/dist/config.js +10 -11
  17. package/dist/internal/devices.d.ts +2 -2
  18. package/dist/internal/devices.js +39 -49
  19. package/dist/internal/error.d.ts +9 -204
  20. package/dist/internal/error.js +19 -288
  21. package/dist/internal/file_index.d.ts +1 -1
  22. package/dist/internal/file_index.js +9 -9
  23. package/dist/internal/filesystem.d.ts +23 -8
  24. package/dist/internal/index.d.ts +1 -1
  25. package/dist/internal/index.js +1 -1
  26. package/dist/internal/index_fs.d.ts +2 -2
  27. package/dist/internal/index_fs.js +19 -19
  28. package/dist/internal/inode.d.ts +81 -103
  29. package/dist/internal/inode.js +336 -195
  30. package/dist/mixins/async.js +32 -28
  31. package/dist/mixins/mutexed.d.ts +4 -4
  32. package/dist/mixins/mutexed.js +39 -39
  33. package/dist/mixins/readonly.d.ts +2 -2
  34. package/dist/mixins/readonly.js +20 -20
  35. package/dist/mixins/sync.js +2 -2
  36. package/dist/polyfills.js +1 -1
  37. package/dist/readline.js +1 -1
  38. package/dist/utils.d.ts +8 -5
  39. package/dist/utils.js +14 -17
  40. package/dist/vfs/acl.d.ts +8 -8
  41. package/dist/vfs/acl.js +66 -47
  42. package/dist/vfs/async.d.ts +2 -2
  43. package/dist/vfs/async.js +6 -8
  44. package/dist/vfs/dir.d.ts +1 -1
  45. package/dist/vfs/dir.js +3 -4
  46. package/dist/vfs/file.js +33 -24
  47. package/dist/vfs/flags.js +3 -3
  48. package/dist/vfs/ioctl.d.ts +8 -7
  49. package/dist/vfs/ioctl.js +132 -27
  50. package/dist/vfs/promises.d.ts +3 -3
  51. package/dist/vfs/promises.js +200 -235
  52. package/dist/vfs/shared.d.ts +1 -12
  53. package/dist/vfs/shared.js +7 -35
  54. package/dist/vfs/streams.js +9 -9
  55. package/dist/vfs/sync.d.ts +1 -2
  56. package/dist/vfs/sync.js +158 -170
  57. package/dist/vfs/watchers.js +8 -8
  58. package/dist/vfs/xattr.js +89 -106
  59. package/package.json +5 -3
  60. package/scripts/test.js +2 -2
  61. package/tests/assignment.ts +1 -1
  62. package/tests/backend/port.test.ts +4 -4
  63. package/tests/backend/single-buffer.test.ts +39 -10
  64. package/tests/backend/single-buffer.worker.js +30 -0
  65. package/tests/common/context.test.ts +2 -2
  66. package/tests/common/mutex.test.ts +9 -9
  67. package/tests/fetch/fetch.ts +1 -1
  68. package/tests/fetch/run.sh +1 -1
  69. package/tests/fs/append.test.ts +4 -4
  70. package/tests/fs/directory.test.ts +25 -25
  71. package/tests/fs/errors.test.ts +15 -19
  72. package/tests/fs/links.test.ts +3 -2
  73. package/tests/fs/open.test.ts +4 -21
  74. package/tests/fs/permissions.test.ts +8 -13
  75. package/tests/fs/read.test.ts +10 -9
  76. package/tests/fs/readFile.test.ts +8 -24
  77. package/tests/fs/rename.test.ts +4 -9
  78. package/tests/fs/stat.test.ts +2 -2
  79. package/tests/fs/times.test.ts +6 -6
  80. package/tests/fs/truncate.test.ts +8 -36
  81. package/tests/fs/watch.test.ts +10 -10
  82. package/tests/fs/write.test.ts +77 -13
  83. package/tests/fs/xattr.test.ts +7 -7
  84. package/tests/logs.js +2 -2
  85. package/tests/setup/port.ts +6 -0
  86. package/dist/internal/log.d.ts +0 -139
  87. package/dist/internal/log.js +0 -219
  88. package/tests/fs/writeFile.test.ts +0 -70
@@ -1,5 +1,6 @@
1
- import { Errno, ErrnoError } from '../internal/error.js';
2
- import { debug, err } from '../internal/log.js';
1
+ /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents */
2
+ import { withErrno } from 'kerium';
3
+ import { debug, err } from 'kerium/log';
3
4
  /**
4
5
  * @category Backends and Configuration
5
6
  * @internal
@@ -27,7 +28,7 @@ export function _fnOpt(name, fn) {
27
28
  */
28
29
  export function checkOptions(backend, options) {
29
30
  if (typeof options != 'object' || options === null) {
30
- throw err(new ErrnoError(Errno.EINVAL, 'Invalid options'));
31
+ throw err(withErrno('EINVAL', 'Invalid options'));
31
32
  }
32
33
  // Check for required options.
33
34
  for (const [optName, opt] of Object.entries(backend.options)) {
@@ -37,7 +38,7 @@ export function checkOptions(backend, options) {
37
38
  debug('Using default for option: ' + optName);
38
39
  continue;
39
40
  }
40
- throw err(new ErrnoError(Errno.EINVAL, 'Missing required option: ' + optName));
41
+ throw err(withErrno('EINVAL', 'Missing required option: ' + optName));
41
42
  }
42
43
  const isType = (type, _ = value) => {
43
44
  var _a;
@@ -54,7 +55,7 @@ export function checkOptions(backend, options) {
54
55
  // The expected type (as a string)
55
56
  const name = (type) => (typeof type == 'function' ? (type.name != 'type' ? type.name : type.toString()) : type);
56
57
  const expected = Array.isArray(opt.type) ? `one of ${opt.type.map(name).join(', ')}` : name(opt.type);
57
- throw err(new ErrnoError(Errno.EINVAL, `Incorrect type for "${optName}": ${type} (expected ${expected})`));
58
+ throw err(withErrno('EINVAL', `Incorrect type for "${optName}": ${type} (expected ${expected})`));
58
59
  }
59
60
  }
60
61
  /**
@@ -73,8 +73,8 @@ export declare class CopyOnWriteFS extends FileSystem {
73
73
  * @todo Consider trying to track information on the writable as well
74
74
  */
75
75
  usage(): UsageInfo;
76
- sync(path: string): Promise<void>;
77
- syncSync(path: string): void;
76
+ sync(): Promise<void>;
77
+ syncSync(): void;
78
78
  read(path: string, buffer: Uint8Array, offset: number, end: number): Promise<void>;
79
79
  readSync(path: string, buffer: Uint8Array, offset: number, end: number): void;
80
80
  write(path: string, buffer: Uint8Array, offset: number): Promise<void>;
@@ -1,10 +1,10 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
+ import { withErrno } from 'kerium';
3
+ import { debug, err, warn } from 'kerium/log';
2
4
  import { canary } from 'utilium';
3
5
  import { resolveMountConfig } from '../config.js';
4
- import { Errno, ErrnoError } from '../internal/error.js';
5
6
  import { FileSystem } from '../internal/filesystem.js';
6
7
  import { isDirectory } from '../internal/inode.js';
7
- import { debug, err, warn } from '../internal/log.js';
8
8
  import { dirname, join } from '../path.js';
9
9
  const journalOperations = ['delete'];
10
10
  /** Because TS doesn't work right w/o it */
@@ -31,7 +31,7 @@ export class Journal extends EventEmitter {
31
31
  */
32
32
  fromString(value) {
33
33
  if (!value.startsWith(journalMagicString))
34
- throw err(new ErrnoError(Errno.EINVAL, 'Invalid journal contents, refusing to parse'));
34
+ throw err(withErrno('EINVAL', 'Invalid journal contents, refusing to parse'));
35
35
  for (const line of value.split('\n')) {
36
36
  if (line.startsWith('#'))
37
37
  continue; // ignore comments
@@ -91,7 +91,7 @@ export class CopyOnWriteFS extends FileSystem {
91
91
  this.writable = writable;
92
92
  this.journal = journal;
93
93
  if (writable.attributes.has('no_write')) {
94
- throw err(new ErrnoError(Errno.EINVAL, 'Writable file system can not be written to'));
94
+ throw err(withErrno('EINVAL', 'Writable file system can not be written to'));
95
95
  }
96
96
  readable.attributes.set('no_write');
97
97
  }
@@ -104,13 +104,11 @@ export class CopyOnWriteFS extends FileSystem {
104
104
  usage() {
105
105
  return this.readable.usage();
106
106
  }
107
- async sync(path) {
108
- await this.copyForWrite(path);
109
- await this.writable.sync(path);
107
+ async sync() {
108
+ await this.writable.sync();
110
109
  }
111
- syncSync(path) {
112
- this.copyForWriteSync(path);
113
- this.writable.syncSync(path);
110
+ syncSync() {
111
+ this.writable.syncSync();
114
112
  }
115
113
  async read(path, buffer, offset, end) {
116
114
  return (await this.writable.exists(path))
@@ -134,9 +132,8 @@ export class CopyOnWriteFS extends FileSystem {
134
132
  await this.writable.rename(oldPath, newPath);
135
133
  }
136
134
  catch {
137
- if (this.isDeleted(oldPath)) {
138
- throw ErrnoError.With('ENOENT', oldPath, 'rename');
139
- }
135
+ if (this.isDeleted(oldPath))
136
+ throw withErrno('ENOENT');
140
137
  }
141
138
  }
142
139
  renameSync(oldPath, newPath) {
@@ -145,9 +142,8 @@ export class CopyOnWriteFS extends FileSystem {
145
142
  this.writable.renameSync(oldPath, newPath);
146
143
  }
147
144
  catch {
148
- if (this.isDeleted(oldPath)) {
149
- throw ErrnoError.With('ENOENT', oldPath, 'rename');
150
- }
145
+ if (this.isDeleted(oldPath))
146
+ throw withErrno('ENOENT');
151
147
  }
152
148
  }
153
149
  async stat(path) {
@@ -156,11 +152,8 @@ export class CopyOnWriteFS extends FileSystem {
156
152
  }
157
153
  catch {
158
154
  if (this.isDeleted(path))
159
- throw ErrnoError.With('ENOENT', path, 'stat');
160
- const oldStat = await this.readable.stat(path);
161
- // Make the oldStat's mode writable.
162
- oldStat.mode |= 0o222;
163
- return oldStat;
155
+ throw withErrno('ENOENT');
156
+ return await this.readable.stat(path);
164
157
  }
165
158
  }
166
159
  statSync(path) {
@@ -169,11 +162,8 @@ export class CopyOnWriteFS extends FileSystem {
169
162
  }
170
163
  catch {
171
164
  if (this.isDeleted(path))
172
- throw ErrnoError.With('ENOENT', path, 'stat');
173
- const oldStat = this.readable.statSync(path);
174
- // Make the oldStat's mode writable.
175
- oldStat.mode |= 0o222;
176
- return oldStat;
165
+ throw withErrno('ENOENT');
166
+ return this.readable.statSync(path);
177
167
  }
178
168
  }
179
169
  async touch(path, metadata) {
@@ -201,9 +191,8 @@ export class CopyOnWriteFS extends FileSystem {
201
191
  this.writable.linkSync(srcpath, dstpath);
202
192
  }
203
193
  async unlink(path) {
204
- if (!(await this.exists(path))) {
205
- throw ErrnoError.With('ENOENT', path, 'unlink');
206
- }
194
+ if (!(await this.exists(path)))
195
+ throw withErrno('ENOENT');
207
196
  if (await this.writable.exists(path)) {
208
197
  await this.writable.unlink(path);
209
198
  }
@@ -214,7 +203,7 @@ export class CopyOnWriteFS extends FileSystem {
214
203
  }
215
204
  unlinkSync(path) {
216
205
  if (!this.existsSync(path))
217
- throw ErrnoError.With('ENOENT', path, 'unlink');
206
+ throw withErrno('ENOENT');
218
207
  if (this.writable.existsSync(path)) {
219
208
  this.writable.unlinkSync(path);
220
209
  }
@@ -224,9 +213,8 @@ export class CopyOnWriteFS extends FileSystem {
224
213
  }
225
214
  }
226
215
  async rmdir(path) {
227
- if (!(await this.exists(path))) {
228
- throw ErrnoError.With('ENOENT', path, 'rmdir');
229
- }
216
+ if (!(await this.exists(path)))
217
+ throw withErrno('ENOENT');
230
218
  if (await this.writable.exists(path)) {
231
219
  await this.writable.rmdir(path);
232
220
  }
@@ -234,15 +222,13 @@ export class CopyOnWriteFS extends FileSystem {
234
222
  return;
235
223
  }
236
224
  // Check if directory is empty.
237
- if ((await this.readdir(path)).length) {
238
- throw ErrnoError.With('ENOTEMPTY', path, 'rmdir');
239
- }
225
+ if ((await this.readdir(path)).length)
226
+ throw withErrno('ENOTEMPTY');
240
227
  this.journal.add('delete', path);
241
228
  }
242
229
  rmdirSync(path) {
243
- if (!this.existsSync(path)) {
244
- throw ErrnoError.With('ENOENT', path, 'rmdir');
245
- }
230
+ if (!this.existsSync(path))
231
+ throw withErrno('ENOENT');
246
232
  if (this.writable.existsSync(path)) {
247
233
  this.writable.rmdirSync(path);
248
234
  }
@@ -250,26 +236,25 @@ export class CopyOnWriteFS extends FileSystem {
250
236
  return;
251
237
  }
252
238
  // Check if directory is empty.
253
- if (this.readdirSync(path).length) {
254
- throw ErrnoError.With('ENOTEMPTY', path, 'rmdir');
255
- }
239
+ if (this.readdirSync(path).length)
240
+ throw withErrno('ENOTEMPTY');
256
241
  this.journal.add('delete', path);
257
242
  }
258
243
  async mkdir(path, options) {
259
244
  if (await this.exists(path))
260
- throw ErrnoError.With('EEXIST', path, 'mkdir');
245
+ throw withErrno('EEXIST');
261
246
  await this.createParentDirectories(path);
262
247
  return await this.writable.mkdir(path, options);
263
248
  }
264
249
  mkdirSync(path, options) {
265
250
  if (this.existsSync(path))
266
- throw ErrnoError.With('EEXIST', path, 'mkdir');
251
+ throw withErrno('EEXIST');
267
252
  this.createParentDirectoriesSync(path);
268
253
  return this.writable.mkdirSync(path, options);
269
254
  }
270
255
  async readdir(path) {
271
256
  if (this.isDeleted(path) || !(await this.exists(path)))
272
- throw ErrnoError.With('ENOENT', path, 'readdir');
257
+ throw withErrno('ENOENT');
273
258
  const entries = (await this.readable.exists(path)) ? await this.readable.readdir(path) : [];
274
259
  if (await this.writable.exists(path))
275
260
  for (const entry of await this.writable.readdir(path)) {
@@ -280,7 +265,7 @@ export class CopyOnWriteFS extends FileSystem {
280
265
  }
281
266
  readdirSync(path) {
282
267
  if (this.isDeleted(path) || !this.existsSync(path))
283
- throw ErrnoError.With('ENOENT', path, 'readdir');
268
+ throw withErrno('ENOENT');
284
269
  const entries = this.readable.existsSync(path) ? this.readable.readdirSync(path) : [];
285
270
  if (this.writable.existsSync(path))
286
271
  for (const entry of this.writable.readdirSync(path)) {
@@ -302,7 +287,7 @@ export class CopyOnWriteFS extends FileSystem {
302
287
  */
303
288
  createParentDirectoriesSync(path) {
304
289
  const toCreate = [];
305
- const silence = canary(ErrnoError.With('EDEADLK', path));
290
+ const silence = canary(withErrno('EDEADLK'));
306
291
  for (let parent = dirname(path); !this.writable.existsSync(parent); parent = dirname(parent)) {
307
292
  toCreate.push(parent);
308
293
  }
@@ -319,7 +304,7 @@ export class CopyOnWriteFS extends FileSystem {
319
304
  */
320
305
  async createParentDirectories(path) {
321
306
  const toCreate = [];
322
- const silence = canary(ErrnoError.With('EDEADLK', path));
307
+ const silence = canary(withErrno('EDEADLK', path));
323
308
  for (let parent = dirname(path); !(await this.writable.exists(parent)); parent = dirname(parent)) {
324
309
  toCreate.push(parent);
325
310
  }
@@ -336,9 +321,8 @@ export class CopyOnWriteFS extends FileSystem {
336
321
  * - Calls f to perform operation on writable.
337
322
  */
338
323
  copyForWriteSync(path) {
339
- if (!this.existsSync(path)) {
340
- throw ErrnoError.With('ENOENT', path, '[copyForWrite]');
341
- }
324
+ if (!this.existsSync(path))
325
+ throw withErrno('ENOENT');
342
326
  if (!this.writable.existsSync(dirname(path))) {
343
327
  this.createParentDirectoriesSync(path);
344
328
  }
@@ -347,9 +331,8 @@ export class CopyOnWriteFS extends FileSystem {
347
331
  }
348
332
  }
349
333
  async copyForWrite(path) {
350
- if (!(await this.exists(path))) {
351
- throw ErrnoError.With('ENOENT', path, '[copyForWrite]');
352
- }
334
+ if (!(await this.exists(path)))
335
+ throw withErrno('ENOENT');
353
336
  if (!(await this.writable.exists(dirname(path)))) {
354
337
  await this.createParentDirectories(path);
355
338
  }
@@ -362,8 +345,7 @@ export class CopyOnWriteFS extends FileSystem {
362
345
  * PRECONDITION: File does not exist on writable storage.
363
346
  */
364
347
  copyToWritableSync(path) {
365
- const stats = this.statSync(path);
366
- stats.mode |= 0o222;
348
+ const stats = this.readable.statSync(path);
367
349
  if (isDirectory(stats)) {
368
350
  this.writable.mkdirSync(path, stats);
369
351
  for (const k of this.readable.readdirSync(path)) {
@@ -378,8 +360,7 @@ export class CopyOnWriteFS extends FileSystem {
378
360
  this.writable.writeSync(path, data, 0);
379
361
  }
380
362
  async copyToWritable(path) {
381
- const stats = await this.stat(path);
382
- stats.mode |= 0o222;
363
+ const stats = await this.readable.stat(path);
383
364
  if (isDirectory(stats)) {
384
365
  await this.writable.mkdir(path, stats);
385
366
  for (const k of await this.readable.readdir(path)) {
@@ -1,27 +1,25 @@
1
+ import { withErrno } from 'kerium';
2
+ import { err, warn } from 'kerium/log';
1
3
  import { decodeUTF8 } from 'utilium';
2
4
  import * as requests from 'utilium/requests.js';
3
- import { Errno, ErrnoError } from '../internal/error.js';
4
5
  import { Index } from '../internal/file_index.js';
5
6
  import { IndexFS } from '../internal/index_fs.js';
6
- import { err, warn } from '../internal/log.js';
7
7
  import { normalizePath } from '../utils.js';
8
8
  import { S_IFREG } from '../vfs/constants.js';
9
9
  /** Parse and throw */
10
- function parseError(path, fs) {
11
- return (error) => {
12
- if (!('tag' in error))
13
- throw err(new ErrnoError(Errno.EIO, error.stack, path), { fs });
14
- switch (error.tag) {
15
- case 'fetch':
16
- throw err(new ErrnoError(Errno.EREMOTEIO, error.message, path), { fs });
17
- case 'status':
18
- throw err(new ErrnoError(error.response.status > 500 ? Errno.EREMOTEIO : Errno.EIO, 'Response status code is ' + error.response.status, path), { fs });
19
- case 'size':
20
- throw err(new ErrnoError(Errno.EBADE, error.message, path), { fs });
21
- case 'buffer':
22
- throw err(new ErrnoError(Errno.EIO, 'Failed to decode buffer', path), { fs });
23
- }
24
- };
10
+ function parseError(error) {
11
+ if (!('tag' in error))
12
+ throw err(withErrno('EIO', error.stack));
13
+ switch (error.tag) {
14
+ case 'fetch':
15
+ throw err(withErrno('EREMOTEIO', error.message));
16
+ case 'status':
17
+ throw err(withErrno(error.response.status > 500 ? 'EREMOTEIO' : 'EIO', 'Response status code is ' + error.response.status));
18
+ case 'size':
19
+ throw err(withErrno('EBADE', error.message));
20
+ case 'buffer':
21
+ throw err(withErrno('EIO', 'Failed to decode buffer'));
22
+ }
25
23
  }
26
24
  /**
27
25
  * A simple filesystem backed by HTTP using the `fetch` API.
@@ -51,45 +49,45 @@ export class FetchFS extends IndexFS {
51
49
  async read(path, buffer, offset = 0, end) {
52
50
  const inode = this.index.get(path);
53
51
  if (!inode)
54
- throw ErrnoError.With('ENOENT', path, 'read');
52
+ throw withErrno('ENOENT');
55
53
  if (end - offset == 0)
56
54
  return;
57
55
  const data = await requests
58
56
  .get(this.baseUrl + path, { start: offset, end, size: inode.size, warn }, this.requestInit)
59
- .catch(parseError(path, this))
57
+ .catch(parseError)
60
58
  .catch(() => undefined);
61
59
  if (!data)
62
- throw ErrnoError.With('ENODATA', path, 'read');
60
+ throw withErrno('ENODATA');
63
61
  buffer.set(data);
64
62
  }
65
63
  readSync(path, buffer, offset = 0, end) {
66
64
  const inode = this.index.get(path);
67
65
  if (!inode)
68
- throw ErrnoError.With('ENOENT', path, 'read');
66
+ throw withErrno('ENOENT');
69
67
  if (end - offset == 0)
70
68
  return;
71
69
  const { data, missing } = requests.getCached(this.baseUrl + path, { start: offset, end, size: inode.size, warn });
72
70
  if (!data)
73
- throw ErrnoError.With('ENODATA', path, 'read');
71
+ throw withErrno('ENODATA');
74
72
  if (missing.length) {
75
73
  this._async(requests.get(this.baseUrl + path, { start: offset, end, size: inode.size, warn }));
76
- throw ErrnoError.With('EAGAIN', path, 'read');
74
+ throw withErrno('EAGAIN');
77
75
  }
78
76
  buffer.set(data);
79
77
  }
80
78
  async write(path, data, offset) {
81
79
  const inode = this.index.get(path);
82
80
  if (!inode)
83
- throw ErrnoError.With('ENOENT', path, 'write');
81
+ throw withErrno('ENOENT');
84
82
  inode.update({ mtimeMs: Date.now(), size: Math.max(inode.size, data.byteLength + offset) });
85
- await requests.set(this.baseUrl + path, data, { offset, warn, cacheOnly: !this.remoteWrite }, this.requestInit).catch(parseError(path, this));
83
+ await requests.set(this.baseUrl + path, data, { offset, warn, cacheOnly: !this.remoteWrite }, this.requestInit).catch(parseError);
86
84
  }
87
85
  writeSync(path, data, offset) {
88
86
  const inode = this.index.get(path);
89
87
  if (!inode)
90
- throw ErrnoError.With('ENOENT', path, 'write');
88
+ throw withErrno('ENOENT');
91
89
  inode.update({ mtimeMs: Date.now(), size: Math.max(inode.size, data.byteLength + offset) });
92
- this._async(requests.set(this.baseUrl + path, data, { offset, warn, cacheOnly: !this.remoteWrite }, this.requestInit).catch(parseError(path, this)));
90
+ this._async(requests.set(this.baseUrl + path, data, { offset, warn, cacheOnly: !this.remoteWrite }, this.requestInit).catch(parseError));
93
91
  }
94
92
  }
95
93
  const _Fetch = {
@@ -116,7 +114,7 @@ const _Fetch = {
116
114
  index.fromJSON(options.index);
117
115
  }
118
116
  else {
119
- const data = await requests.get(options.index, { warn }, options.requestInit).catch(parseError());
117
+ const data = await requests.get(options.index, { warn }, options.requestInit).catch(parseError);
120
118
  index.fromJSON(JSON.parse(decodeUTF8(data)));
121
119
  }
122
120
  const fs = new FetchFS(index, baseUrl, options.requestInit, options.remoteWrite);
@@ -126,7 +124,7 @@ const _Fetch = {
126
124
  for (const [path, node] of index) {
127
125
  if (!(node.mode & S_IFREG))
128
126
  continue;
129
- await requests.get(baseUrl + path, { warn }, options.requestInit).catch(parseError(path, fs));
127
+ await requests.get(baseUrl + path, { warn }, options.requestInit).catch(parseError);
130
128
  }
131
129
  return fs;
132
130
  },
@@ -17,7 +17,6 @@ export declare class PassthroughFS extends FileSystem {
17
17
  constructor(nodeFS: NodeFS, prefix: string);
18
18
  usage(): UsageInfo;
19
19
  path(path: string): string;
20
- error(err: unknown, path: string): never;
21
20
  /**
22
21
  * Rename a file or directory.
23
22
  */
@@ -79,11 +78,11 @@ export declare class PassthroughFS extends FileSystem {
79
78
  /**
80
79
  * Synchronize data to the file system.
81
80
  */
82
- sync(path: string): Promise<void>;
81
+ sync(): Promise<void>;
83
82
  /**
84
83
  * Synchronize data to the file system synchronously.
85
84
  */
86
- syncSync(path: string): void;
85
+ syncSync(): void;
87
86
  /**
88
87
  * Create a hard link.
89
88
  */