@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
@@ -0,0 +1,521 @@
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 * as constants from './constants';
12
+ export { constants };
13
+ import { FileFlag } from '../file';
14
+ import { normalizePath, normalizeMode, getFdForFile, normalizeOptions, fd2file, fdMap, normalizeTime, cred, nop, resolveFS, fixError, mounts } from './shared';
15
+ /**
16
+ * Utility for FS ops. It handles
17
+ * - path normalization (for the first parameter to the FS op)
18
+ * - path translation for errors
19
+ * - FS/mount point resolution
20
+ *
21
+ * It can't be used for functions which may operate on multiple mounted FSs or paths (e.g. `rename`)
22
+ * @param name the function name
23
+ * @param resolveSymlinks whether to resolve symlinks
24
+ * @param args the rest of the parameters are passed to the FS function. Note that the first parameter is required to be a path
25
+ * @returns
26
+ */
27
+ function doOp(...[name, resolveSymlinks, path, ...args]) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ path = normalizePath(path);
30
+ const { fs, path: resolvedPath } = resolveFS(resolveSymlinks && (yield exists(path)) ? yield realpath(path) : path);
31
+ try {
32
+ // @ts-expect-error 2556 (since ...args is not correctly picked up as being a tuple)
33
+ return fs[name](resolvedPath, ...args);
34
+ }
35
+ catch (e) {
36
+ throw fixError(e, { [resolvedPath]: path });
37
+ }
38
+ });
39
+ }
40
+ // fs.promises
41
+ /**
42
+ * Renames a file
43
+ * @param oldPath
44
+ * @param newPath
45
+ */
46
+ export function rename(oldPath, newPath) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ oldPath = normalizePath(oldPath);
49
+ newPath = normalizePath(newPath);
50
+ const _old = resolveFS(oldPath);
51
+ const _new = resolveFS(newPath);
52
+ const paths = { [_old.path]: oldPath, [_new.path]: newPath };
53
+ try {
54
+ if (_old === _new) {
55
+ return _old.fs.rename(_old.path, _new.path, cred);
56
+ }
57
+ const data = yield readFile(oldPath);
58
+ yield writeFile(newPath, data);
59
+ yield unlink(oldPath);
60
+ }
61
+ catch (e) {
62
+ throw fixError(e, paths);
63
+ }
64
+ });
65
+ }
66
+ /**
67
+ * Test whether or not the given path exists by checking with the file system.
68
+ * @param path
69
+ */
70
+ export function exists(path) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ path = normalizePath(path);
73
+ try {
74
+ const { fs, path: resolvedPath } = resolveFS(path);
75
+ return fs.exists(resolvedPath, cred);
76
+ }
77
+ catch (e) {
78
+ if (e.errno == ErrorCode.ENOENT) {
79
+ return false;
80
+ }
81
+ throw e;
82
+ }
83
+ });
84
+ }
85
+ /**
86
+ * `stat`.
87
+ * @param path
88
+ * @returns Stats
89
+ */
90
+ export function stat(path) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ return doOp('stat', true, path, cred);
93
+ });
94
+ }
95
+ /**
96
+ * `lstat`.
97
+ * `lstat()` is identical to `stat()`, except that if path is a symbolic link,
98
+ * then the link itself is stat-ed, not the file that it refers to.
99
+ * @param path
100
+ * @return [ZenFS.node.fs.Stats]
101
+ */
102
+ export function lstat(path) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ return doOp('stat', false, path, cred);
105
+ });
106
+ }
107
+ // FILE-ONLY METHODS
108
+ /**
109
+ * `truncate`.
110
+ * @param path
111
+ * @param len
112
+ */
113
+ export function truncate(path, len = 0) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ if (len < 0) {
116
+ throw new ApiError(ErrorCode.EINVAL);
117
+ }
118
+ return doOp('truncate', true, path, len, cred);
119
+ });
120
+ }
121
+ /**
122
+ * `unlink`.
123
+ * @param path
124
+ */
125
+ export function unlink(path) {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ return doOp('unlink', false, path, cred);
128
+ });
129
+ }
130
+ /**
131
+ * file open.
132
+ * @see http://www.manpagez.com/man/2/open/
133
+ * @param path
134
+ * @param flags
135
+ * @param mode defaults to `0644`
136
+ */
137
+ export function open(path, flag, mode = 0o644) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ const file = yield doOp('open', true, path, FileFlag.getFileFlag(flag), normalizeMode(mode, 0o644), cred);
140
+ return getFdForFile(file);
141
+ });
142
+ }
143
+ export function readFile(filename, arg2 = {}) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ const options = normalizeOptions(arg2, null, 'r', null);
146
+ const flag = FileFlag.getFileFlag(options.flag);
147
+ if (!flag.isReadable()) {
148
+ throw new ApiError(ErrorCode.EINVAL, 'Flag passed to readFile must allow for reading.');
149
+ }
150
+ return doOp('readFile', true, filename, options.encoding, flag, cred);
151
+ });
152
+ }
153
+ export function writeFile(filename, data, arg3) {
154
+ return __awaiter(this, void 0, void 0, function* () {
155
+ const options = normalizeOptions(arg3, 'utf8', 'w', 0o644);
156
+ const flag = FileFlag.getFileFlag(options.flag);
157
+ if (!flag.isWriteable()) {
158
+ throw new ApiError(ErrorCode.EINVAL, 'Flag passed to writeFile must allow for writing.');
159
+ }
160
+ return doOp('writeFile', true, filename, data, options.encoding, flag, options.mode, cred);
161
+ });
162
+ }
163
+ export function appendFile(filename, data, arg3) {
164
+ return __awaiter(this, void 0, void 0, function* () {
165
+ const options = normalizeOptions(arg3, 'utf8', 'a', 0o644);
166
+ const flag = FileFlag.getFileFlag(options.flag);
167
+ if (!flag.isAppendable()) {
168
+ throw new ApiError(ErrorCode.EINVAL, 'Flag passed to appendFile must allow for appending.');
169
+ }
170
+ return doOp('appendFile', true, filename, data, options.encoding, flag, options.mode, cred);
171
+ });
172
+ }
173
+ // FILE DESCRIPTOR METHODS
174
+ /**
175
+ * `fstat`.
176
+ * `fstat()` is identical to `stat()`, except that the file to be stat-ed is
177
+ * specified by the file descriptor `fd`.
178
+ * @param fd
179
+ * @return [ZenFS.node.fs.Stats]
180
+ */
181
+ export function fstat(fd) {
182
+ return __awaiter(this, void 0, void 0, function* () {
183
+ return fd2file(fd).stat();
184
+ });
185
+ }
186
+ /**
187
+ * close.
188
+ * @param fd
189
+ */
190
+ export function close(fd) {
191
+ return __awaiter(this, void 0, void 0, function* () {
192
+ yield fd2file(fd).close();
193
+ fdMap.delete(fd);
194
+ return;
195
+ });
196
+ }
197
+ /**
198
+ * ftruncate.
199
+ * @param fd
200
+ * @param len
201
+ */
202
+ export function ftruncate(fd, len = 0) {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ const file = fd2file(fd);
205
+ if (len < 0) {
206
+ throw new ApiError(ErrorCode.EINVAL);
207
+ }
208
+ return file.truncate(len);
209
+ });
210
+ }
211
+ /**
212
+ * fsync.
213
+ * @param fd
214
+ */
215
+ export function fsync(fd) {
216
+ return __awaiter(this, void 0, void 0, function* () {
217
+ return fd2file(fd).sync();
218
+ });
219
+ }
220
+ /**
221
+ * fdatasync.
222
+ * @param fd
223
+ */
224
+ export function fdatasync(fd) {
225
+ return __awaiter(this, void 0, void 0, function* () {
226
+ return fd2file(fd).datasync();
227
+ });
228
+ }
229
+ export function write(fd, arg2, arg3, arg4, arg5) {
230
+ return __awaiter(this, void 0, void 0, function* () {
231
+ let buffer, offset = 0, length, position;
232
+ if (typeof arg2 === 'string') {
233
+ // Signature 1: (fd, string, [position?, [encoding?]])
234
+ position = typeof arg3 === 'number' ? arg3 : null;
235
+ const encoding = (typeof arg4 === 'string' ? arg4 : 'utf8');
236
+ offset = 0;
237
+ buffer = Buffer.from(arg2, encoding);
238
+ length = buffer.length;
239
+ }
240
+ else {
241
+ // Signature 2: (fd, buffer, offset, length, position?)
242
+ buffer = arg2;
243
+ offset = arg3;
244
+ length = arg4;
245
+ position = typeof arg5 === 'number' ? arg5 : null;
246
+ }
247
+ const file = fd2file(fd);
248
+ if (position === undefined || position === null) {
249
+ position = file.getPos();
250
+ }
251
+ return file.write(buffer, offset, length, position);
252
+ });
253
+ }
254
+ /**
255
+ * Read data from the file specified by `fd`.
256
+ * @param fd
257
+ * @param buffer The buffer that the data will be
258
+ * written to.
259
+ * @param offset The offset within the buffer where writing will
260
+ * start.
261
+ * @param length An integer specifying the number of bytes to read.
262
+ * @param position An integer specifying where to begin reading from
263
+ * in the file. If position is null, data will be read from the current file
264
+ * position.
265
+ */
266
+ export function read(fd, buffer, offset, length, position) {
267
+ return __awaiter(this, void 0, void 0, function* () {
268
+ const file = fd2file(fd);
269
+ if (isNaN(+position)) {
270
+ position = file.getPos();
271
+ }
272
+ return file.read(buffer, offset, length, position);
273
+ });
274
+ }
275
+ /**
276
+ * `fchown`.
277
+ * @param fd
278
+ * @param uid
279
+ * @param gid
280
+ */
281
+ export function fchown(fd, uid, gid) {
282
+ return __awaiter(this, void 0, void 0, function* () {
283
+ return fd2file(fd).chown(uid, gid);
284
+ });
285
+ }
286
+ /**
287
+ * `fchmod`.
288
+ * @param fd
289
+ * @param mode
290
+ */
291
+ export function fchmod(fd, mode) {
292
+ return __awaiter(this, void 0, void 0, function* () {
293
+ const numMode = typeof mode === 'string' ? parseInt(mode, 8) : mode;
294
+ return fd2file(fd).chmod(numMode);
295
+ });
296
+ }
297
+ /**
298
+ * Change the file timestamps of a file referenced by the supplied file
299
+ * descriptor.
300
+ * @param fd
301
+ * @param atime
302
+ * @param mtime
303
+ */
304
+ export function futimes(fd, atime, mtime) {
305
+ return __awaiter(this, void 0, void 0, function* () {
306
+ return fd2file(fd).utimes(normalizeTime(atime), normalizeTime(mtime));
307
+ });
308
+ }
309
+ // DIRECTORY-ONLY METHODS
310
+ /**
311
+ * `rmdir`.
312
+ * @param path
313
+ */
314
+ export function rmdir(path) {
315
+ return __awaiter(this, void 0, void 0, function* () {
316
+ return doOp('rmdir', true, path, cred);
317
+ });
318
+ }
319
+ /**
320
+ * `mkdir`.
321
+ * @param path
322
+ * @param mode defaults to `0777`
323
+ */
324
+ export function mkdir(path, mode) {
325
+ return __awaiter(this, void 0, void 0, function* () {
326
+ return doOp('mkdir', true, path, normalizeMode(mode, 0o777), cred);
327
+ });
328
+ }
329
+ /**
330
+ * `readdir`. Reads the contents of a directory.
331
+ * @param path
332
+ * @return [String[]]
333
+ */
334
+ export function readdir(path) {
335
+ return __awaiter(this, void 0, void 0, function* () {
336
+ path = normalizePath(path);
337
+ const entries = yield doOp('readdir', true, path, cred);
338
+ const points = [...mounts.keys()];
339
+ for (const point of points) {
340
+ if (point.startsWith(path)) {
341
+ const entry = point.slice(path.length);
342
+ if (entry.includes('/') || entry.length == 0) {
343
+ // ignore FSs mounted in subdirectories and any FS mounted to `path`.
344
+ continue;
345
+ }
346
+ entries.push(entry);
347
+ }
348
+ }
349
+ return entries;
350
+ });
351
+ }
352
+ // SYMLINK METHODS
353
+ /**
354
+ * `link`.
355
+ * @param srcpath
356
+ * @param dstpath
357
+ */
358
+ export function link(srcpath, dstpath) {
359
+ return __awaiter(this, void 0, void 0, function* () {
360
+ dstpath = normalizePath(dstpath);
361
+ return doOp('link', false, srcpath, dstpath, cred);
362
+ });
363
+ }
364
+ /**
365
+ * `symlink`.
366
+ * @param srcpath
367
+ * @param dstpath
368
+ * @param type can be either `'dir'` or `'file'` (default is `'file'`)
369
+ */
370
+ export function symlink(srcpath, dstpath, type = 'file') {
371
+ return __awaiter(this, void 0, void 0, function* () {
372
+ if (!['file', 'dir', 'junction'].includes(type)) {
373
+ throw new ApiError(ErrorCode.EINVAL, 'Invalid type: ' + type);
374
+ }
375
+ dstpath = normalizePath(dstpath);
376
+ return doOp('symlink', false, srcpath, dstpath, type, cred);
377
+ });
378
+ }
379
+ /**
380
+ * readlink.
381
+ * @param path
382
+ * @return [String]
383
+ */
384
+ export function readlink(path) {
385
+ return __awaiter(this, void 0, void 0, function* () {
386
+ return doOp('readlink', false, path, cred);
387
+ });
388
+ }
389
+ // PROPERTY OPERATIONS
390
+ /**
391
+ * `chown`.
392
+ * @param path
393
+ * @param uid
394
+ * @param gid
395
+ */
396
+ export function chown(path, uid, gid) {
397
+ return __awaiter(this, void 0, void 0, function* () {
398
+ return doOp('chown', true, path, uid, gid, cred);
399
+ });
400
+ }
401
+ /**
402
+ * `lchown`.
403
+ * @param path
404
+ * @param uid
405
+ * @param gid
406
+ */
407
+ export function lchown(path, uid, gid) {
408
+ return __awaiter(this, void 0, void 0, function* () {
409
+ return doOp('chown', false, path, uid, gid, cred);
410
+ });
411
+ }
412
+ /**
413
+ * `chmod`.
414
+ * @param path
415
+ * @param mode
416
+ */
417
+ export function chmod(path, mode) {
418
+ return __awaiter(this, void 0, void 0, function* () {
419
+ const numMode = normalizeMode(mode, -1);
420
+ if (numMode < 0) {
421
+ throw new ApiError(ErrorCode.EINVAL, `Invalid mode.`);
422
+ }
423
+ return doOp('chmod', true, path, numMode, cred);
424
+ });
425
+ }
426
+ /**
427
+ * `lchmod`.
428
+ * @param path
429
+ * @param mode
430
+ */
431
+ export function lchmod(path, mode) {
432
+ return __awaiter(this, void 0, void 0, function* () {
433
+ const numMode = normalizeMode(mode, -1);
434
+ if (numMode < 1) {
435
+ throw new ApiError(ErrorCode.EINVAL, `Invalid mode.`);
436
+ }
437
+ return doOp('chmod', false, normalizePath(path), numMode, cred);
438
+ });
439
+ }
440
+ /**
441
+ * Change file timestamps of the file referenced by the supplied path.
442
+ * @param path
443
+ * @param atime
444
+ * @param mtime
445
+ */
446
+ export function utimes(path, atime, mtime) {
447
+ return __awaiter(this, void 0, void 0, function* () {
448
+ return doOp('utimes', true, path, normalizeTime(atime), normalizeTime(mtime), cred);
449
+ });
450
+ }
451
+ /**
452
+ * Change file timestamps of the file referenced by the supplied path.
453
+ * @param path
454
+ * @param atime
455
+ * @param mtime
456
+ */
457
+ export function lutimes(path, atime, mtime) {
458
+ return __awaiter(this, void 0, void 0, function* () {
459
+ return doOp('utimes', false, path, normalizeTime(atime), normalizeTime(mtime), cred);
460
+ });
461
+ }
462
+ /**
463
+ * `realpath`.
464
+ * @param path
465
+ * @param cache An object literal of mapped paths that can be used to
466
+ * force a specific path resolution or avoid additional `fs.stat` calls for
467
+ * known real paths.
468
+ * @return [String]
469
+ */
470
+ export function realpath(path, cache = {}) {
471
+ return __awaiter(this, void 0, void 0, function* () {
472
+ path = normalizePath(path);
473
+ const { fs, path: resolvedPath, mountPoint } = resolveFS(path);
474
+ try {
475
+ const stats = yield fs.stat(resolvedPath, cred);
476
+ if (!stats.isSymbolicLink()) {
477
+ return path;
478
+ }
479
+ const dst = mountPoint + normalizePath(yield fs.readlink(resolvedPath, cred));
480
+ return realpath(dst);
481
+ }
482
+ catch (e) {
483
+ throw fixError(e, { [resolvedPath]: path });
484
+ }
485
+ });
486
+ }
487
+ export function watchFile(filename, arg2, listener = nop) {
488
+ return __awaiter(this, void 0, void 0, function* () {
489
+ throw new ApiError(ErrorCode.ENOTSUP);
490
+ });
491
+ }
492
+ export function unwatchFile(filename, listener = nop) {
493
+ return __awaiter(this, void 0, void 0, function* () {
494
+ throw new ApiError(ErrorCode.ENOTSUP);
495
+ });
496
+ }
497
+ export function watch(filename, arg2, listener = nop) {
498
+ return __awaiter(this, void 0, void 0, function* () {
499
+ throw new ApiError(ErrorCode.ENOTSUP);
500
+ });
501
+ }
502
+ /**
503
+ * `access`.
504
+ * @param path
505
+ * @param mode
506
+ */
507
+ export function access(path, mode = 0o600) {
508
+ return __awaiter(this, void 0, void 0, function* () {
509
+ return doOp('access', true, path, mode, cred);
510
+ });
511
+ }
512
+ export function createReadStream(path, options) {
513
+ return __awaiter(this, void 0, void 0, function* () {
514
+ throw new ApiError(ErrorCode.ENOTSUP);
515
+ });
516
+ }
517
+ export function createWriteStream(path, options) {
518
+ return __awaiter(this, void 0, void 0, function* () {
519
+ throw new ApiError(ErrorCode.ENOTSUP);
520
+ });
521
+ }
@@ -0,0 +1,62 @@
1
+ /// <reference types="node" />
2
+ import { Cred } from '../cred';
3
+ import { FileSystem } from '../filesystem';
4
+ import { File } from '../file';
5
+ import { BackendConstructor } from '../backends/backend';
6
+ /**
7
+ * converts Date or number to a fractional UNIX timestamp
8
+ * Grabbed from NodeJS sources (lib/fs.js)
9
+ */
10
+ export declare function _toUnixTimestamp(time: Date | number): number;
11
+ export declare function normalizeMode(mode: unknown, def: number): number;
12
+ export declare function normalizeTime(time: number | Date): Date;
13
+ export declare function normalizePath(p: string): string;
14
+ export declare function normalizeOptions(options: any, defEnc: string | null, defFlag: string, defMode: number | null): {
15
+ encoding: BufferEncoding;
16
+ flag: string;
17
+ mode: number;
18
+ };
19
+ export declare function nop(): void;
20
+ export declare let cred: Cred;
21
+ export declare function setCred(val: Cred): void;
22
+ export declare const fdMap: Map<number, File>;
23
+ export declare function getFdForFile(file: File): number;
24
+ export declare function fd2file(fd: number): File;
25
+ export interface MountMapping {
26
+ [point: string]: InstanceType<BackendConstructor>;
27
+ }
28
+ export declare const mounts: Map<string, FileSystem>;
29
+ /**
30
+ * Gets the file system mounted at `mountPoint`
31
+ */
32
+ export declare function getMount(mountPoint: string): FileSystem;
33
+ /**
34
+ * Gets an object of mount points (keys) and filesystems (values)
35
+ */
36
+ export declare function getMounts(): MountMapping;
37
+ /**
38
+ * Mounts the file system at the given mount point.
39
+ */
40
+ export declare function mount(mountPoint: string, fs: FileSystem): void;
41
+ /**
42
+ * Unmounts the file system at the given mount point.
43
+ */
44
+ export declare function umount(mountPoint: string): void;
45
+ /**
46
+ * Gets the internal FileSystem for the path, then returns it along with the path relative to the FS' root
47
+ */
48
+ export declare function resolveFS(path: string): {
49
+ fs: FileSystem;
50
+ path: string;
51
+ mountPoint: string;
52
+ };
53
+ /**
54
+ * Reverse maps the paths in text from the mounted FileSystem to the global path
55
+ */
56
+ export declare function fixPaths(text: string, paths: {
57
+ [from: string]: string;
58
+ }): string;
59
+ export declare function fixError<E extends Error>(e: E, paths: {
60
+ [from: string]: string;
61
+ }): E;
62
+ export declare function initialize(mountMapping: MountMapping): void;