@zenfs/core 0.17.0 → 0.18.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.
Files changed (72) hide show
  1. package/dist/backends/backend.d.ts +2 -3
  2. package/dist/backends/fetch.js +2 -2
  3. package/dist/backends/file_index.d.ts +14 -15
  4. package/dist/backends/file_index.js +3 -9
  5. package/dist/backends/overlay.d.ts +21 -22
  6. package/dist/backends/overlay.js +111 -114
  7. package/dist/backends/port/fs.d.ts +21 -22
  8. package/dist/backends/port/fs.js +23 -23
  9. package/dist/backends/store/fs.d.ts +20 -21
  10. package/dist/backends/store/fs.js +70 -138
  11. package/dist/browser.min.js +4 -4
  12. package/dist/browser.min.js.map +4 -4
  13. package/dist/config.js +2 -2
  14. package/dist/{cred.d.ts → credentials.d.ts} +3 -2
  15. package/dist/credentials.js +16 -0
  16. package/dist/emulation/async.d.ts +20 -5
  17. package/dist/emulation/async.js +57 -9
  18. package/dist/emulation/dir.d.ts +4 -7
  19. package/dist/emulation/dir.js +16 -24
  20. package/dist/emulation/promises.d.ts +3 -3
  21. package/dist/emulation/promises.js +103 -46
  22. package/dist/emulation/shared.d.ts +0 -3
  23. package/dist/emulation/shared.js +0 -6
  24. package/dist/emulation/sync.d.ts +3 -4
  25. package/dist/emulation/sync.js +107 -65
  26. package/dist/emulation/watchers.d.ts +40 -3
  27. package/dist/emulation/watchers.js +115 -9
  28. package/dist/error.d.ts +1 -1
  29. package/dist/error.js +1 -1
  30. package/dist/filesystem.d.ts +23 -24
  31. package/dist/filesystem.js +6 -6
  32. package/dist/index.d.ts +2 -1
  33. package/dist/index.js +2 -1
  34. package/dist/mixins/async.d.ts +13 -14
  35. package/dist/mixins/async.js +45 -47
  36. package/dist/mixins/index.d.ts +4 -0
  37. package/dist/mixins/index.js +4 -0
  38. package/dist/mixins/mutexed.d.ts +1 -1
  39. package/dist/mixins/mutexed.js +61 -53
  40. package/dist/mixins/readonly.d.ts +14 -15
  41. package/dist/mixins/readonly.js +12 -12
  42. package/dist/mixins/sync.js +20 -20
  43. package/dist/stats.d.ts +12 -5
  44. package/dist/stats.js +11 -2
  45. package/dist/utils.d.ts +3 -9
  46. package/dist/utils.js +7 -24
  47. package/package.json +4 -3
  48. package/src/backends/backend.ts +2 -3
  49. package/src/backends/fetch.ts +2 -2
  50. package/src/backends/file_index.ts +3 -12
  51. package/src/backends/overlay.ts +112 -116
  52. package/src/backends/port/fs.ts +25 -26
  53. package/src/backends/store/fs.ts +72 -151
  54. package/src/config.ts +3 -2
  55. package/src/{cred.ts → credentials.ts} +11 -2
  56. package/src/emulation/async.ts +76 -18
  57. package/src/emulation/dir.ts +21 -29
  58. package/src/emulation/promises.ts +107 -46
  59. package/src/emulation/shared.ts +0 -8
  60. package/src/emulation/sync.ts +109 -66
  61. package/src/emulation/watchers.ts +140 -10
  62. package/src/error.ts +1 -1
  63. package/src/filesystem.ts +25 -26
  64. package/src/index.ts +2 -1
  65. package/src/mixins/async.ts +54 -55
  66. package/src/mixins/index.ts +4 -0
  67. package/src/mixins/mutexed.ts +62 -55
  68. package/src/mixins/readonly.ts +26 -27
  69. package/src/mixins/sync.ts +22 -23
  70. package/src/stats.ts +15 -5
  71. package/src/utils.ts +9 -34
  72. package/dist/cred.js +0 -8
@@ -43,10 +43,11 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
43
43
  var e = new Error(message);
44
44
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
45
45
  });
46
- import { R_OK, S_IFDIR, S_IFREG, W_OK } from '../../emulation/constants.js';
46
+ import { credentials } from '../../credentials.js';
47
+ import { S_IFDIR, S_IFREG } from '../../emulation/constants.js';
47
48
  import { basename, dirname, join, resolve } from '../../emulation/path.js';
48
49
  import { Errno, ErrnoError } from '../../error.js';
49
- import { PreloadFile, flagToMode } from '../../file.js';
50
+ import { PreloadFile } from '../../file.js';
50
51
  import { FileSystem } from '../../filesystem.js';
51
52
  import { Inode, randomIno, rootIno } from '../../inode.js';
52
53
  import { decodeDirListing, encode, encodeDirListing } from '../../utils.js';
@@ -99,16 +100,13 @@ export class StoreFS extends FileSystem {
99
100
  /**
100
101
  * @todo Make rename compatible with the cache.
101
102
  */
102
- async rename(oldPath, newPath, cred) {
103
+ async rename(oldPath, newPath) {
103
104
  const env_1 = { stack: [], error: void 0, hasError: false };
104
105
  try {
105
106
  const tx = __addDisposableResource(env_1, this.store.transaction(), true);
106
107
  const oldParent = dirname(oldPath), oldName = basename(oldPath), newParent = dirname(newPath), newName = basename(newPath),
107
108
  // Remove oldPath from parent's directory listing.
108
109
  oldDirNode = await this.findINode(tx, oldParent), oldDirList = await this.getDirListing(tx, oldDirNode, oldParent);
109
- if (!oldDirNode.toStats().hasAccess(W_OK, cred)) {
110
- throw ErrnoError.With('EACCES', oldPath, 'rename');
111
- }
112
110
  if (!oldDirList[oldName]) {
113
111
  throw ErrnoError.With('ENOENT', oldPath, 'rename');
114
112
  }
@@ -134,16 +132,13 @@ export class StoreFS extends FileSystem {
134
132
  newDirList = await this.getDirListing(tx, newDirNode, newParent);
135
133
  }
136
134
  if (newDirList[newName]) {
137
- // If it's a file, delete it.
135
+ // If it's a file, delete it, if it's a directory, throw a permissions error.
138
136
  const newNameNode = await this.getINode(tx, newDirList[newName], newPath);
139
- if (newNameNode.toStats().isFile()) {
140
- await tx.remove(newNameNode.ino);
141
- await tx.remove(newDirList[newName]);
142
- }
143
- else {
144
- // If it's a directory, throw a permissions error.
137
+ if (!newNameNode.toStats().isFile()) {
145
138
  throw ErrnoError.With('EPERM', newPath, 'rename');
146
139
  }
140
+ await tx.remove(newNameNode.ino);
141
+ await tx.remove(newDirList[newName]);
147
142
  }
148
143
  newDirList[newName] = nodeId;
149
144
  // Commit the two changed directory listings.
@@ -161,16 +156,13 @@ export class StoreFS extends FileSystem {
161
156
  await result_1;
162
157
  }
163
158
  }
164
- renameSync(oldPath, newPath, cred) {
159
+ renameSync(oldPath, newPath) {
165
160
  const env_2 = { stack: [], error: void 0, hasError: false };
166
161
  try {
167
162
  const tx = __addDisposableResource(env_2, this.store.transaction(), false);
168
163
  const oldParent = dirname(oldPath), oldName = basename(oldPath), newParent = dirname(newPath), newName = basename(newPath),
169
164
  // Remove oldPath from parent's directory listing.
170
165
  oldDirNode = this.findINodeSync(tx, oldParent), oldDirList = this.getDirListingSync(tx, oldDirNode, oldParent);
171
- if (!oldDirNode.toStats().hasAccess(W_OK, cred)) {
172
- throw ErrnoError.With('EACCES', oldPath, 'rename');
173
- }
174
166
  if (!oldDirList[oldName]) {
175
167
  throw ErrnoError.With('ENOENT', oldPath, 'rename');
176
168
  }
@@ -196,16 +188,13 @@ export class StoreFS extends FileSystem {
196
188
  newDirList = this.getDirListingSync(tx, newDirNode, newParent);
197
189
  }
198
190
  if (newDirList[newName]) {
199
- // If it's a file, delete it.
191
+ // If it's a file, delete it, if it's a directory, throw a permissions error.
200
192
  const newNameNode = this.getINodeSync(tx, newDirList[newName], newPath);
201
- if (newNameNode.toStats().isFile()) {
202
- tx.removeSync(newNameNode.ino);
203
- tx.removeSync(newDirList[newName]);
204
- }
205
- else {
206
- // If it's a directory, throw a permissions error.
193
+ if (!newNameNode.toStats().isFile()) {
207
194
  throw ErrnoError.With('EPERM', newPath, 'rename');
208
195
  }
196
+ tx.removeSync(newNameNode.ino);
197
+ tx.removeSync(newDirList[newName]);
209
198
  }
210
199
  newDirList[newName] = ino;
211
200
  // Commit the two changed directory listings.
@@ -221,7 +210,7 @@ export class StoreFS extends FileSystem {
221
210
  __disposeResources(env_2);
222
211
  }
223
212
  }
224
- async stat(path, cred) {
213
+ async stat(path) {
225
214
  const env_3 = { stack: [], error: void 0, hasError: false };
226
215
  try {
227
216
  const tx = __addDisposableResource(env_3, this.store.transaction(), true);
@@ -229,11 +218,7 @@ export class StoreFS extends FileSystem {
229
218
  if (!inode) {
230
219
  throw ErrnoError.With('ENOENT', path, 'stat');
231
220
  }
232
- const stats = inode.toStats();
233
- if (!stats.hasAccess(R_OK, cred)) {
234
- throw ErrnoError.With('EACCES', path, 'stat');
235
- }
236
- return stats;
221
+ return inode.toStats();
237
222
  }
238
223
  catch (e_3) {
239
224
  env_3.error = e_3;
@@ -245,16 +230,12 @@ export class StoreFS extends FileSystem {
245
230
  await result_2;
246
231
  }
247
232
  }
248
- statSync(path, cred) {
233
+ statSync(path) {
249
234
  const env_4 = { stack: [], error: void 0, hasError: false };
250
235
  try {
251
236
  const tx = __addDisposableResource(env_4, this.store.transaction(), false);
252
237
  // Get the inode to the item, convert it into a Stats object.
253
- const stats = this.findINodeSync(tx, path).toStats();
254
- if (!stats.hasAccess(R_OK, cred)) {
255
- throw ErrnoError.With('EACCES', path, 'stat');
256
- }
257
- return stats;
238
+ return this.findINodeSync(tx, path).toStats();
258
239
  }
259
240
  catch (e_4) {
260
241
  env_4.error = e_4;
@@ -264,22 +245,19 @@ export class StoreFS extends FileSystem {
264
245
  __disposeResources(env_4);
265
246
  }
266
247
  }
267
- async createFile(path, flag, mode, cred) {
268
- const node = await this.commitNew(path, S_IFREG, mode, cred, new Uint8Array(0));
248
+ async createFile(path, flag, mode) {
249
+ const node = await this.commitNew(path, S_IFREG, mode, new Uint8Array(0));
269
250
  return new PreloadFile(this, path, flag, node.toStats(), new Uint8Array(0));
270
251
  }
271
- createFileSync(path, flag, mode, cred) {
272
- this.commitNewSync(path, S_IFREG, mode, cred);
273
- return this.openFileSync(path, flag, cred);
252
+ createFileSync(path, flag, mode) {
253
+ this.commitNewSync(path, S_IFREG, mode);
254
+ return this.openFileSync(path, flag);
274
255
  }
275
- async openFile(path, flag, cred) {
256
+ async openFile(path, flag) {
276
257
  const env_5 = { stack: [], error: void 0, hasError: false };
277
258
  try {
278
259
  const tx = __addDisposableResource(env_5, this.store.transaction(), true);
279
260
  const node = await this.findINode(tx, path), data = await tx.get(node.ino);
280
- if (!node.toStats().hasAccess(flagToMode(flag), cred)) {
281
- throw ErrnoError.With('EACCES', path, 'openFile');
282
- }
283
261
  if (!data) {
284
262
  throw ErrnoError.With('ENOENT', path, 'openFile');
285
263
  }
@@ -295,14 +273,11 @@ export class StoreFS extends FileSystem {
295
273
  await result_3;
296
274
  }
297
275
  }
298
- openFileSync(path, flag, cred) {
276
+ openFileSync(path, flag) {
299
277
  const env_6 = { stack: [], error: void 0, hasError: false };
300
278
  try {
301
279
  const tx = __addDisposableResource(env_6, this.store.transaction(), false);
302
280
  const node = this.findINodeSync(tx, path), data = tx.getSync(node.ino);
303
- if (!node.toStats().hasAccess(flagToMode(flag), cred)) {
304
- throw ErrnoError.With('EACCES', path, 'openFile');
305
- }
306
281
  if (!data) {
307
282
  throw ErrnoError.With('ENOENT', path, 'openFile');
308
283
  }
@@ -316,43 +291,37 @@ export class StoreFS extends FileSystem {
316
291
  __disposeResources(env_6);
317
292
  }
318
293
  }
319
- async unlink(path, cred) {
320
- return this.remove(path, false, cred);
294
+ async unlink(path) {
295
+ return this.remove(path, false);
321
296
  }
322
- unlinkSync(path, cred) {
323
- this.removeSync(path, false, cred);
297
+ unlinkSync(path) {
298
+ this.removeSync(path, false);
324
299
  }
325
- async rmdir(path, cred) {
300
+ async rmdir(path) {
326
301
  // Check first if directory is empty.
327
- const list = await this.readdir(path, cred);
328
- if (list.length > 0) {
302
+ if ((await this.readdir(path)).length) {
329
303
  throw ErrnoError.With('ENOTEMPTY', path, 'rmdir');
330
304
  }
331
- await this.remove(path, true, cred);
305
+ await this.remove(path, true);
332
306
  }
333
- rmdirSync(path, cred) {
307
+ rmdirSync(path) {
334
308
  // Check first if directory is empty.
335
- if (this.readdirSync(path, cred).length > 0) {
309
+ if (this.readdirSync(path).length) {
336
310
  throw ErrnoError.With('ENOTEMPTY', path, 'rmdir');
337
311
  }
338
- else {
339
- this.removeSync(path, true, cred);
340
- }
312
+ this.removeSync(path, true);
341
313
  }
342
- async mkdir(path, mode, cred) {
343
- await this.commitNew(path, S_IFDIR, mode, cred, encode('{}'));
314
+ async mkdir(path, mode) {
315
+ await this.commitNew(path, S_IFDIR, mode, encode('{}'));
344
316
  }
345
- mkdirSync(path, mode, cred) {
346
- this.commitNewSync(path, S_IFDIR, mode, cred, encode('{}'));
317
+ mkdirSync(path, mode) {
318
+ this.commitNewSync(path, S_IFDIR, mode, encode('{}'));
347
319
  }
348
- async readdir(path, cred) {
320
+ async readdir(path) {
349
321
  const env_7 = { stack: [], error: void 0, hasError: false };
350
322
  try {
351
323
  const tx = __addDisposableResource(env_7, this.store.transaction(), true);
352
324
  const node = await this.findINode(tx, path);
353
- if (!node.toStats().hasAccess(R_OK, cred)) {
354
- throw ErrnoError.With('EACCES', path, 'readdur');
355
- }
356
325
  return Object.keys(await this.getDirListing(tx, node, path));
357
326
  }
358
327
  catch (e_7) {
@@ -365,14 +334,11 @@ export class StoreFS extends FileSystem {
365
334
  await result_4;
366
335
  }
367
336
  }
368
- readdirSync(path, cred) {
337
+ readdirSync(path) {
369
338
  const env_8 = { stack: [], error: void 0, hasError: false };
370
339
  try {
371
340
  const tx = __addDisposableResource(env_8, this.store.transaction(), false);
372
341
  const node = this.findINodeSync(tx, path);
373
- if (!node.toStats().hasAccess(R_OK, cred)) {
374
- throw ErrnoError.With('EACCES', path, 'readdir');
375
- }
376
342
  return Object.keys(this.getDirListingSync(tx, node, path));
377
343
  }
378
344
  catch (e_8) {
@@ -437,27 +403,17 @@ export class StoreFS extends FileSystem {
437
403
  __disposeResources(env_10);
438
404
  }
439
405
  }
440
- async link(existing, newpath, cred) {
406
+ async link(target, link) {
441
407
  const env_11 = { stack: [], error: void 0, hasError: false };
442
408
  try {
443
409
  const tx = __addDisposableResource(env_11, this.store.transaction(), true);
444
- const existingDir = dirname(existing), existingDirNode = await this.findINode(tx, existingDir);
445
- if (!existingDirNode.toStats().hasAccess(R_OK, cred)) {
446
- throw ErrnoError.With('EACCES', existingDir, 'link');
447
- }
448
- const newDir = dirname(newpath), newDirNode = await this.findINode(tx, newDir), newListing = await this.getDirListing(tx, newDirNode, newDir);
449
- if (!newDirNode.toStats().hasAccess(W_OK, cred)) {
450
- throw ErrnoError.With('EACCES', newDir, 'link');
451
- }
452
- const ino = await this._findINode(tx, existingDir, basename(existing));
453
- const node = await this.getINode(tx, ino, existing);
454
- if (!node.toStats().hasAccess(W_OK, cred)) {
455
- throw ErrnoError.With('EACCES', newpath, 'link');
456
- }
410
+ const newDir = dirname(link), newDirNode = await this.findINode(tx, newDir), listing = await this.getDirListing(tx, newDirNode, newDir);
411
+ const ino = await this._findINode(tx, dirname(target), basename(target));
412
+ const node = await this.getINode(tx, ino, target);
457
413
  node.nlink++;
458
- newListing[basename(newpath)] = ino;
414
+ listing[basename(link)] = ino;
459
415
  tx.setSync(ino, node.data);
460
- tx.setSync(newDirNode.ino, encodeDirListing(newListing));
416
+ tx.setSync(newDirNode.ino, encodeDirListing(listing));
461
417
  tx.commitSync();
462
418
  }
463
419
  catch (e_11) {
@@ -470,27 +426,17 @@ export class StoreFS extends FileSystem {
470
426
  await result_6;
471
427
  }
472
428
  }
473
- linkSync(existing, newpath, cred) {
429
+ linkSync(target, link) {
474
430
  const env_12 = { stack: [], error: void 0, hasError: false };
475
431
  try {
476
432
  const tx = __addDisposableResource(env_12, this.store.transaction(), false);
477
- const existingDir = dirname(existing), existingDirNode = this.findINodeSync(tx, existingDir);
478
- if (!existingDirNode.toStats().hasAccess(R_OK, cred)) {
479
- throw ErrnoError.With('EACCES', existingDir, 'link');
480
- }
481
- const newDir = dirname(newpath), newDirNode = this.findINodeSync(tx, newDir), newListing = this.getDirListingSync(tx, newDirNode, newDir);
482
- if (!newDirNode.toStats().hasAccess(W_OK, cred)) {
483
- throw ErrnoError.With('EACCES', newDir, 'link');
484
- }
485
- const ino = this._findINodeSync(tx, existingDir, basename(existing));
486
- const node = this.getINodeSync(tx, ino, existing);
487
- if (!node.toStats().hasAccess(W_OK, cred)) {
488
- throw ErrnoError.With('EACCES', newpath, 'link');
489
- }
433
+ const newDir = dirname(link), newDirNode = this.findINodeSync(tx, newDir), listing = this.getDirListingSync(tx, newDirNode, newDir);
434
+ const ino = this._findINodeSync(tx, dirname(target), basename(target));
435
+ const node = this.getINodeSync(tx, ino, target);
490
436
  node.nlink++;
491
- newListing[basename(newpath)] = ino;
437
+ listing[basename(link)] = ino;
492
438
  tx.setSync(ino, node.data);
493
- tx.setSync(newDirNode.ino, encodeDirListing(newListing));
439
+ tx.setSync(newDirNode.ino, encodeDirListing(listing));
494
440
  tx.commitSync();
495
441
  }
496
442
  catch (e_12) {
@@ -719,15 +665,11 @@ export class StoreFS extends FileSystem {
719
665
  * @param cred The UID/GID to create the file with
720
666
  * @param data The data to store at the file's data node.
721
667
  */
722
- async commitNew(path, type, mode, cred, data) {
668
+ async commitNew(path, type, mode, data) {
723
669
  const env_15 = { stack: [], error: void 0, hasError: false };
724
670
  try {
725
671
  const tx = __addDisposableResource(env_15, this.store.transaction(), true);
726
672
  const parentPath = dirname(path), parent = await this.findINode(tx, parentPath);
727
- //Check that the creater has correct access
728
- if (!parent.toStats().hasAccess(W_OK, cred)) {
729
- throw ErrnoError.With('EACCES', path, 'commitNewFile');
730
- }
731
673
  const fname = basename(path), listing = await this.getDirListing(tx, parent, parentPath);
732
674
  /*
733
675
  The root always exists.
@@ -735,19 +677,19 @@ export class StoreFS extends FileSystem {
735
677
  we will create a file with name '' in root should path == '/'.
736
678
  */
737
679
  if (path === '/') {
738
- throw ErrnoError.With('EEXIST', path, 'commitNewFile');
680
+ throw ErrnoError.With('EEXIST', path, 'commitNew');
739
681
  }
740
682
  // Check if file already exists.
741
683
  if (listing[fname]) {
742
684
  await tx.abort();
743
- throw ErrnoError.With('EEXIST', path, 'commitNewFile');
685
+ throw ErrnoError.With('EEXIST', path, 'commitNew');
744
686
  }
745
687
  // Commit data.
746
688
  const inode = new Inode();
747
689
  inode.ino = await this.addNew(tx, data, path);
748
690
  inode.mode = mode | type;
749
- inode.uid = cred.uid;
750
- inode.gid = cred.gid;
691
+ inode.uid = credentials.uid;
692
+ inode.gid = credentials.gid;
751
693
  inode.size = data.length;
752
694
  // Update and commit parent directory listing.
753
695
  listing[fname] = await this.addNew(tx, inode.data, path);
@@ -774,15 +716,11 @@ export class StoreFS extends FileSystem {
774
716
  * @param data The data to store at the file's data node.
775
717
  * @return The Inode for the new file.
776
718
  */
777
- commitNewSync(path, type, mode, cred, data = new Uint8Array()) {
719
+ commitNewSync(path, type, mode, data = new Uint8Array()) {
778
720
  const env_16 = { stack: [], error: void 0, hasError: false };
779
721
  try {
780
722
  const tx = __addDisposableResource(env_16, this.store.transaction(), false);
781
723
  const parentPath = dirname(path), parent = this.findINodeSync(tx, parentPath);
782
- //Check that the creater has correct access
783
- if (!parent.toStats().hasAccess(W_OK, cred)) {
784
- throw ErrnoError.With('EACCES', path, 'commitNewFile');
785
- }
786
724
  const fname = basename(path), listing = this.getDirListingSync(tx, parent, parentPath);
787
725
  /*
788
726
  The root always exists.
@@ -790,19 +728,19 @@ export class StoreFS extends FileSystem {
790
728
  we will create a file with name '' in root should p == '/'.
791
729
  */
792
730
  if (path === '/') {
793
- throw ErrnoError.With('EEXIST', path, 'commitNewFile');
731
+ throw ErrnoError.With('EEXIST', path, 'commitNew');
794
732
  }
795
733
  // Check if file already exists.
796
734
  if (listing[fname]) {
797
- throw ErrnoError.With('EEXIST', path, 'commitNewFile');
735
+ throw ErrnoError.With('EEXIST', path, 'commitNew');
798
736
  }
799
737
  // Commit data.
800
738
  const node = new Inode();
801
739
  node.ino = this.addNewSync(tx, data, path);
802
740
  node.size = data.length;
803
741
  node.mode = mode | type;
804
- node.uid = cred.uid;
805
- node.gid = cred.gid;
742
+ node.uid = credentials.uid;
743
+ node.gid = credentials.gid;
806
744
  // Update and commit parent directory listing.
807
745
  listing[fname] = this.addNewSync(tx, node.data, path);
808
746
  tx.setSync(parent.ino, encodeDirListing(listing));
@@ -823,27 +761,24 @@ export class StoreFS extends FileSystem {
823
761
  * @param isDir Does the path belong to a directory, or a file?
824
762
  * @todo Update mtime.
825
763
  */
826
- async remove(path, isDir, cred) {
764
+ async remove(path, isDir) {
827
765
  const env_17 = { stack: [], error: void 0, hasError: false };
828
766
  try {
829
767
  const tx = __addDisposableResource(env_17, this.store.transaction(), true);
830
768
  const parent = dirname(path), parentNode = await this.findINode(tx, parent), listing = await this.getDirListing(tx, parentNode, parent), fileName = basename(path);
831
769
  if (!listing[fileName]) {
832
- throw ErrnoError.With('ENOENT', path, 'removeEntry');
770
+ throw ErrnoError.With('ENOENT', path, 'remove');
833
771
  }
834
772
  const fileIno = listing[fileName];
835
773
  // Get file inode.
836
774
  const fileNode = await this.getINode(tx, fileIno, path);
837
- if (!fileNode.toStats().hasAccess(W_OK, cred)) {
838
- throw ErrnoError.With('EACCES', path, 'removeEntry');
839
- }
840
775
  // Remove from directory listing of parent.
841
776
  delete listing[fileName];
842
777
  if (!isDir && fileNode.toStats().isDirectory()) {
843
- throw ErrnoError.With('EISDIR', path, 'removeEntry');
778
+ throw ErrnoError.With('EISDIR', path, 'remove');
844
779
  }
845
780
  if (isDir && !fileNode.toStats().isDirectory()) {
846
- throw ErrnoError.With('ENOTDIR', path, 'removeEntry');
781
+ throw ErrnoError.With('ENOTDIR', path, 'remove');
847
782
  }
848
783
  await tx.set(parentNode.ino, encodeDirListing(listing));
849
784
  if (--fileNode.nlink < 1) {
@@ -870,26 +805,23 @@ export class StoreFS extends FileSystem {
870
805
  * @param isDir Does the path belong to a directory, or a file?
871
806
  * @todo Update mtime.
872
807
  */
873
- removeSync(path, isDir, cred) {
808
+ removeSync(path, isDir) {
874
809
  const env_18 = { stack: [], error: void 0, hasError: false };
875
810
  try {
876
811
  const tx = __addDisposableResource(env_18, this.store.transaction(), false);
877
812
  const parent = dirname(path), parentNode = this.findINodeSync(tx, parent), listing = this.getDirListingSync(tx, parentNode, parent), fileName = basename(path), fileIno = listing[fileName];
878
813
  if (!fileIno) {
879
- throw ErrnoError.With('ENOENT', path, 'removeEntry');
814
+ throw ErrnoError.With('ENOENT', path, 'remove');
880
815
  }
881
816
  // Get file inode.
882
817
  const fileNode = this.getINodeSync(tx, fileIno, path);
883
- if (!fileNode.toStats().hasAccess(W_OK, cred)) {
884
- throw ErrnoError.With('EACCES', path, 'removeEntry');
885
- }
886
818
  // Remove from directory listing of parent.
887
819
  delete listing[fileName];
888
820
  if (!isDir && fileNode.toStats().isDirectory()) {
889
- throw ErrnoError.With('EISDIR', path, 'removeEntry');
821
+ throw ErrnoError.With('EISDIR', path, 'remove');
890
822
  }
891
823
  if (isDir && !fileNode.toStats().isDirectory()) {
892
- throw ErrnoError.With('ENOTDIR', path, 'removeEntry');
824
+ throw ErrnoError.With('ENOTDIR', path, 'remove');
893
825
  }
894
826
  // Update directory listing.
895
827
  tx.setSync(parentNode.ino, encodeDirListing(listing));