@zenfs/core 0.0.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 (55) hide show
  1. package/README.md +293 -0
  2. package/dist/ApiError.d.ts +86 -0
  3. package/dist/ApiError.js +135 -0
  4. package/dist/backends/AsyncMirror.d.ts +102 -0
  5. package/dist/backends/AsyncMirror.js +252 -0
  6. package/dist/backends/AsyncStore.d.ts +166 -0
  7. package/dist/backends/AsyncStore.js +620 -0
  8. package/dist/backends/FolderAdapter.d.ts +52 -0
  9. package/dist/backends/FolderAdapter.js +184 -0
  10. package/dist/backends/InMemory.d.ts +25 -0
  11. package/dist/backends/InMemory.js +46 -0
  12. package/dist/backends/Locked.d.ts +64 -0
  13. package/dist/backends/Locked.js +302 -0
  14. package/dist/backends/OverlayFS.d.ts +120 -0
  15. package/dist/backends/OverlayFS.js +749 -0
  16. package/dist/backends/SyncStore.d.ts +223 -0
  17. package/dist/backends/SyncStore.js +479 -0
  18. package/dist/backends/backend.d.ts +73 -0
  19. package/dist/backends/backend.js +14 -0
  20. package/dist/backends/index.d.ts +11 -0
  21. package/dist/backends/index.js +15 -0
  22. package/dist/browser.min.js +12 -0
  23. package/dist/browser.min.js.map +7 -0
  24. package/dist/cred.d.ts +14 -0
  25. package/dist/cred.js +15 -0
  26. package/dist/emulation/callbacks.d.ts +382 -0
  27. package/dist/emulation/callbacks.js +422 -0
  28. package/dist/emulation/constants.d.ts +101 -0
  29. package/dist/emulation/constants.js +110 -0
  30. package/dist/emulation/fs.d.ts +7 -0
  31. package/dist/emulation/fs.js +5 -0
  32. package/dist/emulation/index.d.ts +5 -0
  33. package/dist/emulation/index.js +7 -0
  34. package/dist/emulation/promises.d.ts +309 -0
  35. package/dist/emulation/promises.js +521 -0
  36. package/dist/emulation/shared.d.ts +62 -0
  37. package/dist/emulation/shared.js +192 -0
  38. package/dist/emulation/sync.d.ts +278 -0
  39. package/dist/emulation/sync.js +392 -0
  40. package/dist/file.d.ts +449 -0
  41. package/dist/file.js +576 -0
  42. package/dist/filesystem.d.ts +367 -0
  43. package/dist/filesystem.js +542 -0
  44. package/dist/index.d.ts +78 -0
  45. package/dist/index.js +113 -0
  46. package/dist/inode.d.ts +51 -0
  47. package/dist/inode.js +112 -0
  48. package/dist/mutex.d.ts +12 -0
  49. package/dist/mutex.js +48 -0
  50. package/dist/stats.d.ts +98 -0
  51. package/dist/stats.js +226 -0
  52. package/dist/utils.d.ts +52 -0
  53. package/dist/utils.js +261 -0
  54. package/license.md +122 -0
  55. package/package.json +61 -0
package/dist/file.js ADDED
@@ -0,0 +1,576 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { ApiError, ErrorCode } from './ApiError';
11
+ import { Stats } from './stats';
12
+ import { getMount } from './emulation/shared';
13
+ import { Buffer } from 'buffer';
14
+ export var ActionType;
15
+ (function (ActionType) {
16
+ // Indicates that the code should not do anything.
17
+ ActionType[ActionType["NOP"] = 0] = "NOP";
18
+ // Indicates that the code should throw an exception.
19
+ ActionType[ActionType["THROW_EXCEPTION"] = 1] = "THROW_EXCEPTION";
20
+ // Indicates that the code should truncate the file, but only if it is a file.
21
+ ActionType[ActionType["TRUNCATE_FILE"] = 2] = "TRUNCATE_FILE";
22
+ // Indicates that the code should create the file.
23
+ ActionType[ActionType["CREATE_FILE"] = 3] = "CREATE_FILE";
24
+ })(ActionType || (ActionType = {}));
25
+ /**
26
+ * Represents one of the following file flags. A convenience object.
27
+ *
28
+ * * `'r'` - Open file for reading. An exception occurs if the file does not exist.
29
+ * * `'r+'` - Open file for reading and writing. An exception occurs if the file does not exist.
30
+ * * `'rs'` - Open file for reading in synchronous mode. Instructs the filesystem to not cache writes.
31
+ * * `'rs+'` - Open file for reading and writing, and opens the file in synchronous mode.
32
+ * * `'w'` - Open file for writing. The file is created (if it does not exist) or truncated (if it exists).
33
+ * * `'wx'` - Like 'w' but opens the file in exclusive mode.
34
+ * * `'w+'` - Open file for reading and writing. The file is created (if it does not exist) or truncated (if it exists).
35
+ * * `'wx+'` - Like 'w+' but opens the file in exclusive mode.
36
+ * * `'a'` - Open file for appending. The file is created if it does not exist.
37
+ * * `'ax'` - Like 'a' but opens the file in exclusive mode.
38
+ * * `'a+'` - Open file for reading and appending. The file is created if it does not exist.
39
+ * * `'ax+'` - Like 'a+' but opens the file in exclusive mode.
40
+ *
41
+ * Exclusive mode ensures that the file path is newly created.
42
+ */
43
+ export class FileFlag {
44
+ /**
45
+ * Get an object representing the given file flag.
46
+ * @param modeStr The string representing the flag
47
+ * @return The FileFlag object representing the flag
48
+ * @throw when the flag string is invalid
49
+ */
50
+ static getFileFlag(flagStr) {
51
+ // Check cache first.
52
+ if (!FileFlag.flagCache.has(flagStr)) {
53
+ FileFlag.flagCache.set(flagStr, new FileFlag(flagStr));
54
+ }
55
+ return FileFlag.flagCache.get(flagStr);
56
+ }
57
+ /**
58
+ * This should never be called directly.
59
+ * @param modeStr The string representing the mode
60
+ * @throw when the mode string is invalid
61
+ */
62
+ constructor(flagStr) {
63
+ this.flagStr = flagStr;
64
+ if (FileFlag.validFlagStrs.indexOf(flagStr) < 0) {
65
+ throw new ApiError(ErrorCode.EINVAL, 'Invalid flag: ' + flagStr);
66
+ }
67
+ }
68
+ /**
69
+ * Get the underlying flag string for this flag.
70
+ */
71
+ getFlagString() {
72
+ return this.flagStr;
73
+ }
74
+ /**
75
+ * Get the equivalent mode (0b0xxx: read, write, execute)
76
+ * Note: Execute will always be 0
77
+ */
78
+ getMode() {
79
+ let mode = 0;
80
+ mode <<= 1;
81
+ mode += +this.isReadable();
82
+ mode <<= 1;
83
+ mode += +this.isWriteable();
84
+ mode <<= 1;
85
+ return mode;
86
+ }
87
+ /**
88
+ * Returns true if the file is readable.
89
+ */
90
+ isReadable() {
91
+ return this.flagStr.indexOf('r') !== -1 || this.flagStr.indexOf('+') !== -1;
92
+ }
93
+ /**
94
+ * Returns true if the file is writeable.
95
+ */
96
+ isWriteable() {
97
+ return this.flagStr.indexOf('w') !== -1 || this.flagStr.indexOf('a') !== -1 || this.flagStr.indexOf('+') !== -1;
98
+ }
99
+ /**
100
+ * Returns true if the file mode should truncate.
101
+ */
102
+ isTruncating() {
103
+ return this.flagStr.indexOf('w') !== -1;
104
+ }
105
+ /**
106
+ * Returns true if the file is appendable.
107
+ */
108
+ isAppendable() {
109
+ return this.flagStr.indexOf('a') !== -1;
110
+ }
111
+ /**
112
+ * Returns true if the file is open in synchronous mode.
113
+ */
114
+ isSynchronous() {
115
+ return this.flagStr.indexOf('s') !== -1;
116
+ }
117
+ /**
118
+ * Returns true if the file is open in exclusive mode.
119
+ */
120
+ isExclusive() {
121
+ return this.flagStr.indexOf('x') !== -1;
122
+ }
123
+ /**
124
+ * Returns one of the static fields on this object that indicates the
125
+ * appropriate response to the path existing.
126
+ */
127
+ pathExistsAction() {
128
+ if (this.isExclusive()) {
129
+ return ActionType.THROW_EXCEPTION;
130
+ }
131
+ else if (this.isTruncating()) {
132
+ return ActionType.TRUNCATE_FILE;
133
+ }
134
+ else {
135
+ return ActionType.NOP;
136
+ }
137
+ }
138
+ /**
139
+ * Returns one of the static fields on this object that indicates the
140
+ * appropriate response to the path not existing.
141
+ */
142
+ pathNotExistsAction() {
143
+ if ((this.isWriteable() || this.isAppendable()) && this.flagStr !== 'r+') {
144
+ return ActionType.CREATE_FILE;
145
+ }
146
+ else {
147
+ return ActionType.THROW_EXCEPTION;
148
+ }
149
+ }
150
+ }
151
+ // Contains cached FileMode instances.
152
+ FileFlag.flagCache = new Map();
153
+ // Array of valid mode strings.
154
+ FileFlag.validFlagStrs = ['r', 'r+', 'rs', 'rs+', 'w', 'wx', 'w+', 'wx+', 'a', 'ax', 'a+', 'ax+'];
155
+ /**
156
+ * Base class that contains shared implementations of functions for the file
157
+ * object.
158
+ */
159
+ export class BaseFile {
160
+ sync() {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ throw new ApiError(ErrorCode.ENOTSUP);
163
+ });
164
+ }
165
+ syncSync() {
166
+ throw new ApiError(ErrorCode.ENOTSUP);
167
+ }
168
+ datasync() {
169
+ return __awaiter(this, void 0, void 0, function* () {
170
+ return this.sync();
171
+ });
172
+ }
173
+ datasyncSync() {
174
+ return this.syncSync();
175
+ }
176
+ chown(uid, gid) {
177
+ return __awaiter(this, void 0, void 0, function* () {
178
+ throw new ApiError(ErrorCode.ENOTSUP);
179
+ });
180
+ }
181
+ chownSync(uid, gid) {
182
+ throw new ApiError(ErrorCode.ENOTSUP);
183
+ }
184
+ chmod(mode) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ throw new ApiError(ErrorCode.ENOTSUP);
187
+ });
188
+ }
189
+ chmodSync(mode) {
190
+ throw new ApiError(ErrorCode.ENOTSUP);
191
+ }
192
+ utimes(atime, mtime) {
193
+ return __awaiter(this, void 0, void 0, function* () {
194
+ throw new ApiError(ErrorCode.ENOTSUP);
195
+ });
196
+ }
197
+ utimesSync(atime, mtime) {
198
+ throw new ApiError(ErrorCode.ENOTSUP);
199
+ }
200
+ }
201
+ /**
202
+ * An implementation of the File interface that operates on a file that is
203
+ * completely in-memory. PreloadFiles are backed by a Buffer.
204
+ *
205
+ * This is also an abstract class, as it lacks an implementation of 'sync' and
206
+ * 'close'. Each filesystem that wishes to use this file representation must
207
+ * extend this class and implement those two methods.
208
+ * @todo 'close' lever that disables functionality once closed.
209
+ */
210
+ export class PreloadFile extends BaseFile {
211
+ /**
212
+ * Creates a file with the given path and, optionally, the given contents. Note
213
+ * that, if contents is specified, it will be mutated by the file!
214
+ * @param _fs The file system that created the file.
215
+ * @param _path
216
+ * @param _mode The mode that the file was opened using.
217
+ * Dictates permissions and where the file pointer starts.
218
+ * @param _stat The stats object for the given file.
219
+ * PreloadFile will mutate this object. Note that this object must contain
220
+ * the appropriate mode that the file was opened as.
221
+ * @param contents A buffer containing the entire
222
+ * contents of the file. PreloadFile will mutate this buffer. If not
223
+ * specified, we assume it is a new file.
224
+ */
225
+ constructor(_fs, _path, _flag, _stat, contents) {
226
+ super();
227
+ this._pos = 0;
228
+ this._dirty = false;
229
+ this._fs = _fs;
230
+ this._path = _path;
231
+ this._flag = _flag;
232
+ this._stat = _stat;
233
+ this._buffer = contents ? contents : Buffer.alloc(0);
234
+ // Note: This invariant is *not* maintained once the file starts getting
235
+ // modified.
236
+ // Note: Only actually matters if file is readable, as writeable modes may
237
+ // truncate/append to file.
238
+ if (this._stat.size !== this._buffer.length && this._flag.isReadable()) {
239
+ throw new Error(`Invalid buffer: Buffer is ${this._buffer.length} long, yet Stats object specifies that file is ${this._stat.size} long.`);
240
+ }
241
+ }
242
+ /**
243
+ * NONSTANDARD: Get the underlying buffer for this file. !!DO NOT MUTATE!! Will mess up dirty tracking.
244
+ */
245
+ getBuffer() {
246
+ return this._buffer;
247
+ }
248
+ /**
249
+ * NONSTANDARD: Get underlying stats for this file. !!DO NOT MUTATE!!
250
+ */
251
+ getStats() {
252
+ return this._stat;
253
+ }
254
+ getFlag() {
255
+ return this._flag;
256
+ }
257
+ /**
258
+ * Get the path to this file.
259
+ * @return [String] The path to the file.
260
+ */
261
+ getPath() {
262
+ return this._path;
263
+ }
264
+ /**
265
+ * Get the current file position.
266
+ *
267
+ * We emulate the following bug mentioned in the Node documentation:
268
+ * > On Linux, positional writes don't work when the file is opened in append
269
+ * mode. The kernel ignores the position argument and always appends the data
270
+ * to the end of the file.
271
+ * @return [Number] The current file position.
272
+ */
273
+ getPos() {
274
+ if (this._flag.isAppendable()) {
275
+ return this._stat.size;
276
+ }
277
+ return this._pos;
278
+ }
279
+ /**
280
+ * Advance the current file position by the indicated number of positions.
281
+ * @param [Number] delta
282
+ */
283
+ advancePos(delta) {
284
+ return (this._pos += delta);
285
+ }
286
+ /**
287
+ * Set the file position.
288
+ * @param [Number] newPos
289
+ */
290
+ setPos(newPos) {
291
+ return (this._pos = newPos);
292
+ }
293
+ /**
294
+ * **Core**: Asynchronous sync. Must be implemented by subclasses of this
295
+ * class.
296
+ * @param [Function(ZenFS.ApiError)] cb
297
+ */
298
+ sync() {
299
+ return __awaiter(this, void 0, void 0, function* () {
300
+ this.syncSync();
301
+ });
302
+ }
303
+ /**
304
+ * **Core**: Synchronous sync.
305
+ */
306
+ syncSync() {
307
+ throw new ApiError(ErrorCode.ENOTSUP);
308
+ }
309
+ /**
310
+ * **Core**: Asynchronous close. Must be implemented by subclasses of this
311
+ * class.
312
+ * @param [Function(ZenFS.ApiError)] cb
313
+ */
314
+ close() {
315
+ return __awaiter(this, void 0, void 0, function* () {
316
+ this.closeSync();
317
+ });
318
+ }
319
+ /**
320
+ * **Core**: Synchronous close.
321
+ */
322
+ closeSync() {
323
+ throw new ApiError(ErrorCode.ENOTSUP);
324
+ }
325
+ /**
326
+ * Asynchronous `stat`.
327
+ * @param [Function(ZenFS.ApiError, ZenFS.node.fs.Stats)] cb
328
+ */
329
+ stat() {
330
+ return __awaiter(this, void 0, void 0, function* () {
331
+ return Stats.clone(this._stat);
332
+ });
333
+ }
334
+ /**
335
+ * Synchronous `stat`.
336
+ */
337
+ statSync() {
338
+ return Stats.clone(this._stat);
339
+ }
340
+ /**
341
+ * Asynchronous truncate.
342
+ * @param [Number] len
343
+ * @param [Function(ZenFS.ApiError)] cb
344
+ */
345
+ truncate(len) {
346
+ this.truncateSync(len);
347
+ if (this._flag.isSynchronous() && !getMount('/').metadata.synchronous) {
348
+ return this.sync();
349
+ }
350
+ }
351
+ /**
352
+ * Synchronous truncate.
353
+ * @param [Number] len
354
+ */
355
+ truncateSync(len) {
356
+ this._dirty = true;
357
+ if (!this._flag.isWriteable()) {
358
+ throw new ApiError(ErrorCode.EPERM, 'File not opened with a writeable mode.');
359
+ }
360
+ this._stat.mtimeMs = Date.now();
361
+ if (len > this._buffer.length) {
362
+ const buf = Buffer.alloc(len - this._buffer.length, 0);
363
+ // Write will set @_stat.size for us.
364
+ this.writeSync(buf, 0, buf.length, this._buffer.length);
365
+ if (this._flag.isSynchronous() && getMount('/').metadata.synchronous) {
366
+ this.syncSync();
367
+ }
368
+ return;
369
+ }
370
+ this._stat.size = len;
371
+ // Truncate buffer to 'len'.
372
+ const newBuff = Buffer.alloc(len);
373
+ this._buffer.copy(newBuff, 0, 0, len);
374
+ this._buffer = newBuff;
375
+ if (this._flag.isSynchronous() && getMount('/').metadata.synchronous) {
376
+ this.syncSync();
377
+ }
378
+ }
379
+ /**
380
+ * Write buffer to the file.
381
+ * Note that it is unsafe to use fs.write multiple times on the same file
382
+ * without waiting for the callback.
383
+ * @param [ZenFS.node.Buffer] buffer Buffer containing the data to write to
384
+ * the file.
385
+ * @param [Number] offset Offset in the buffer to start reading data from.
386
+ * @param [Number] length The amount of bytes to write to the file.
387
+ * @param [Number] position Offset from the beginning of the file where this
388
+ * data should be written. If position is null, the data will be written at
389
+ * the current position.
390
+ * @param [Function(ZenFS.ApiError, Number, ZenFS.node.Buffer)]
391
+ * cb The number specifies the number of bytes written into the file.
392
+ */
393
+ write(buffer, offset, length, position) {
394
+ return __awaiter(this, void 0, void 0, function* () {
395
+ return this.writeSync(buffer, offset, length, position);
396
+ });
397
+ }
398
+ /**
399
+ * Write buffer to the file.
400
+ * Note that it is unsafe to use fs.writeSync multiple times on the same file
401
+ * without waiting for the callback.
402
+ * @param [ZenFS.node.Buffer] buffer Buffer containing the data to write to
403
+ * the file.
404
+ * @param [Number] offset Offset in the buffer to start reading data from.
405
+ * @param [Number] length The amount of bytes to write to the file.
406
+ * @param [Number] position Offset from the beginning of the file where this
407
+ * data should be written. If position is null, the data will be written at
408
+ * the current position.
409
+ * @return [Number]
410
+ */
411
+ writeSync(buffer, offset, length, position) {
412
+ this._dirty = true;
413
+ if (position === undefined || position === null) {
414
+ position = this.getPos();
415
+ }
416
+ if (!this._flag.isWriteable()) {
417
+ throw new ApiError(ErrorCode.EPERM, 'File not opened with a writeable mode.');
418
+ }
419
+ const endFp = position + length;
420
+ if (endFp > this._stat.size) {
421
+ this._stat.size = endFp;
422
+ if (endFp > this._buffer.length) {
423
+ // Extend the buffer!
424
+ const newBuff = Buffer.alloc(endFp);
425
+ this._buffer.copy(newBuff);
426
+ this._buffer = newBuff;
427
+ }
428
+ }
429
+ const len = buffer.copy(this._buffer, position, offset, offset + length);
430
+ this._stat.mtimeMs = Date.now();
431
+ if (this._flag.isSynchronous()) {
432
+ this.syncSync();
433
+ return len;
434
+ }
435
+ this.setPos(position + len);
436
+ return len;
437
+ }
438
+ /**
439
+ * Read data from the file.
440
+ * @param [ZenFS.node.Buffer] buffer The buffer that the data will be
441
+ * written to.
442
+ * @param [Number] offset The offset within the buffer where writing will
443
+ * start.
444
+ * @param [Number] length An integer specifying the number of bytes to read.
445
+ * @param [Number] position An integer specifying where to begin reading from
446
+ * in the file. If position is null, data will be read from the current file
447
+ * position.
448
+ * @param [Function(ZenFS.ApiError, Number, ZenFS.node.Buffer)] cb The
449
+ * number is the number of bytes read
450
+ */
451
+ read(buffer, offset, length, position) {
452
+ return __awaiter(this, void 0, void 0, function* () {
453
+ return { bytesRead: this.readSync(buffer, offset, length, position), buffer };
454
+ });
455
+ }
456
+ /**
457
+ * Read data from the file.
458
+ * @param [ZenFS.node.Buffer] buffer The buffer that the data will be
459
+ * written to.
460
+ * @param [Number] offset The offset within the buffer where writing will
461
+ * start.
462
+ * @param [Number] length An integer specifying the number of bytes to read.
463
+ * @param [Number] position An integer specifying where to begin reading from
464
+ * in the file. If position is null, data will be read from the current file
465
+ * position.
466
+ * @return [Number]
467
+ */
468
+ readSync(buffer, offset, length, position) {
469
+ if (!this._flag.isReadable()) {
470
+ throw new ApiError(ErrorCode.EPERM, 'File not opened with a readable mode.');
471
+ }
472
+ if (position === undefined || position === null) {
473
+ position = this.getPos();
474
+ }
475
+ const endRead = position + length;
476
+ if (endRead > this._stat.size) {
477
+ length = this._stat.size - position;
478
+ }
479
+ const rv = this._buffer.copy(buffer, offset, position, position + length);
480
+ this._stat.atimeMs = Date.now();
481
+ this._pos = position + length;
482
+ return rv;
483
+ }
484
+ /**
485
+ * Asynchronous `fchmod`.
486
+ * @param [Number|String] mode
487
+ */
488
+ chmod(mode) {
489
+ return __awaiter(this, void 0, void 0, function* () {
490
+ this.chmodSync(mode);
491
+ });
492
+ }
493
+ /**
494
+ * Synchronous `fchmod`.
495
+ * @param [Number] mode
496
+ */
497
+ chmodSync(mode) {
498
+ if (!this._fs.metadata.supportsProperties) {
499
+ throw new ApiError(ErrorCode.ENOTSUP);
500
+ }
501
+ this._dirty = true;
502
+ this._stat.chmod(mode);
503
+ this.syncSync();
504
+ }
505
+ /**
506
+ * Asynchronous `fchown`.
507
+ * @param [Number] uid
508
+ * @param [Number] gid
509
+ */
510
+ chown(uid, gid) {
511
+ return __awaiter(this, void 0, void 0, function* () {
512
+ this.chownSync(uid, gid);
513
+ });
514
+ }
515
+ /**
516
+ * Synchronous `fchown`.
517
+ * @param [Number] uid
518
+ * @param [Number] gid
519
+ */
520
+ chownSync(uid, gid) {
521
+ if (!this._fs.metadata.supportsProperties) {
522
+ throw new ApiError(ErrorCode.ENOTSUP);
523
+ }
524
+ this._dirty = true;
525
+ this._stat.chown(uid, gid);
526
+ this.syncSync();
527
+ }
528
+ isDirty() {
529
+ return this._dirty;
530
+ }
531
+ /**
532
+ * Resets the dirty bit. Should only be called after a sync has completed successfully.
533
+ */
534
+ resetDirty() {
535
+ this._dirty = false;
536
+ }
537
+ }
538
+ /**
539
+ * File class for the InMemory and XHR file systems.
540
+ * Doesn't sync to anything, so it works nicely for memory-only files.
541
+ */
542
+ export class NoSyncFile extends PreloadFile {
543
+ constructor(_fs, _path, _flag, _stat, contents) {
544
+ super(_fs, _path, _flag, _stat, contents);
545
+ }
546
+ /**
547
+ * Asynchronous sync. Doesn't do anything, simply calls the cb.
548
+ * @param [Function(ZenFS.ApiError)] cb
549
+ */
550
+ sync() {
551
+ return __awaiter(this, void 0, void 0, function* () {
552
+ return;
553
+ });
554
+ }
555
+ /**
556
+ * Synchronous sync. Doesn't do anything.
557
+ */
558
+ syncSync() {
559
+ // NOP.
560
+ }
561
+ /**
562
+ * Asynchronous close. Doesn't do anything, simply calls the cb.
563
+ * @param [Function(ZenFS.ApiError)] cb
564
+ */
565
+ close() {
566
+ return __awaiter(this, void 0, void 0, function* () {
567
+ return;
568
+ });
569
+ }
570
+ /**
571
+ * Synchronous close. Doesn't do anything.
572
+ */
573
+ closeSync() {
574
+ // NOP.
575
+ }
576
+ }