memfs 4.55.0 → 4.56.2
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.
- package/README.md +75 -2
- package/lib/fsa/index.d.ts +1 -33
- package/lib/fsa/index.js +1 -39
- package/lib/fsa/index.js.map +1 -1
- package/lib/fsa-to-node/index.d.ts +1 -2
- package/lib/fsa-to-node/index.js +2 -5
- package/lib/fsa-to-node/index.js.map +1 -1
- package/lib/index.d.ts +6 -7
- package/lib/index.js +10 -14
- package/lib/index.js.map +1 -1
- package/lib/node-to-fsa/index.d.ts +1 -7
- package/lib/node-to-fsa/index.js +1 -10
- package/lib/node-to-fsa/index.js.map +1 -1
- package/package.json +9 -3
- package/lib/constants.d.ts +0 -67
- package/lib/constants.js +0 -54
- package/lib/constants.js.map +0 -1
- package/lib/consts/AMODE.d.ts +0 -9
- package/lib/consts/AMODE.js +0 -3
- package/lib/consts/AMODE.js.map +0 -1
- package/lib/consts/FLAG.d.ts +0 -53
- package/lib/consts/FLAG.js +0 -36
- package/lib/consts/FLAG.js.map +0 -1
- package/lib/core/File.d.ts +0 -39
- package/lib/core/File.js +0 -72
- package/lib/core/File.js.map +0 -1
- package/lib/core/Link.d.ts +0 -38
- package/lib/core/Link.js +0 -105
- package/lib/core/Link.js.map +0 -1
- package/lib/core/Node.d.ts +0 -85
- package/lib/core/Node.js +0 -287
- package/lib/core/Node.js.map +0 -1
- package/lib/core/Superblock.d.ts +0 -92
- package/lib/core/Superblock.js +0 -689
- package/lib/core/Superblock.js.map +0 -1
- package/lib/core/constants.d.ts +0 -15
- package/lib/core/constants.js +0 -3
- package/lib/core/constants.js.map +0 -1
- package/lib/core/index.d.ts +0 -6
- package/lib/core/index.js +0 -15
- package/lib/core/index.js.map +0 -1
- package/lib/core/json.d.ts +0 -9
- package/lib/core/json.js +0 -35
- package/lib/core/json.js.map +0 -1
- package/lib/core/result.d.ts +0 -11
- package/lib/core/result.js +0 -11
- package/lib/core/result.js.map +0 -1
- package/lib/core/types.d.ts +0 -8
- package/lib/core/types.js +0 -3
- package/lib/core/types.js.map +0 -1
- package/lib/core/util.d.ts +0 -12
- package/lib/core/util.js +0 -74
- package/lib/core/util.js.map +0 -1
- package/lib/encoding.d.ts +0 -6
- package/lib/encoding.js +0 -20
- package/lib/encoding.js.map +0 -1
- package/lib/fsa/CoreFileSystemDirectoryHandle.d.ts +0 -73
- package/lib/fsa/CoreFileSystemDirectoryHandle.js +0 -265
- package/lib/fsa/CoreFileSystemDirectoryHandle.js.map +0 -1
- package/lib/fsa/CoreFileSystemFileHandle.d.ts +0 -25
- package/lib/fsa/CoreFileSystemFileHandle.js +0 -75
- package/lib/fsa/CoreFileSystemFileHandle.js.map +0 -1
- package/lib/fsa/CoreFileSystemHandle.d.ts +0 -34
- package/lib/fsa/CoreFileSystemHandle.js +0 -53
- package/lib/fsa/CoreFileSystemHandle.js.map +0 -1
- package/lib/fsa/CoreFileSystemObserver.d.ts +0 -10
- package/lib/fsa/CoreFileSystemObserver.js +0 -18
- package/lib/fsa/CoreFileSystemObserver.js.map +0 -1
- package/lib/fsa/CoreFileSystemSyncAccessHandle.d.ts +0 -38
- package/lib/fsa/CoreFileSystemSyncAccessHandle.js +0 -123
- package/lib/fsa/CoreFileSystemSyncAccessHandle.js.map +0 -1
- package/lib/fsa/CoreFileSystemWritableFileStream.d.ts +0 -32
- package/lib/fsa/CoreFileSystemWritableFileStream.js +0 -163
- package/lib/fsa/CoreFileSystemWritableFileStream.js.map +0 -1
- package/lib/fsa/CorePermissionStatus.d.ts +0 -9
- package/lib/fsa/CorePermissionStatus.js +0 -14
- package/lib/fsa/CorePermissionStatus.js.map +0 -1
- package/lib/fsa/FileLockManager.d.ts +0 -7
- package/lib/fsa/FileLockManager.js +0 -26
- package/lib/fsa/FileLockManager.js.map +0 -1
- package/lib/fsa/types.d.ts +0 -182
- package/lib/fsa/types.js +0 -3
- package/lib/fsa/types.js.map +0 -1
- package/lib/fsa/util.d.ts +0 -12
- package/lib/fsa/util.js +0 -45
- package/lib/fsa/util.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeCore.d.ts +0 -33
- package/lib/fsa-to-node/FsaNodeCore.js +0 -191
- package/lib/fsa-to-node/FsaNodeCore.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeDirent.d.ts +0 -19
- package/lib/fsa-to-node/FsaNodeDirent.js +0 -39
- package/lib/fsa-to-node/FsaNodeDirent.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeFs.d.ts +0 -187
- package/lib/fsa-to-node/FsaNodeFs.js +0 -831
- package/lib/fsa-to-node/FsaNodeFs.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeFsOpenFile.d.ts +0 -24
- package/lib/fsa-to-node/FsaNodeFsOpenFile.js +0 -37
- package/lib/fsa-to-node/FsaNodeFsOpenFile.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeReadStream.d.ts +0 -23
- package/lib/fsa-to-node/FsaNodeReadStream.js +0 -92
- package/lib/fsa-to-node/FsaNodeReadStream.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeStats.d.ts +0 -30
- package/lib/fsa-to-node/FsaNodeStats.js +0 -53
- package/lib/fsa-to-node/FsaNodeStats.js.map +0 -1
- package/lib/fsa-to-node/FsaNodeWriteStream.d.ts +0 -47
- package/lib/fsa-to-node/FsaNodeWriteStream.js +0 -150
- package/lib/fsa-to-node/FsaNodeWriteStream.js.map +0 -1
- package/lib/fsa-to-node/constants.d.ts +0 -3
- package/lib/fsa-to-node/constants.js +0 -3
- package/lib/fsa-to-node/constants.js.map +0 -1
- package/lib/fsa-to-node/json.d.ts +0 -2
- package/lib/fsa-to-node/json.js +0 -7
- package/lib/fsa-to-node/json.js.map +0 -1
- package/lib/fsa-to-node/types.d.ts +0 -37
- package/lib/fsa-to-node/types.js +0 -3
- package/lib/fsa-to-node/types.js.map +0 -1
- package/lib/fsa-to-node/util.d.ts +0 -4
- package/lib/fsa-to-node/util.js +0 -34
- package/lib/fsa-to-node/util.js.map +0 -1
- package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.d.ts +0 -10
- package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.js +0 -62
- package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.js.map +0 -1
- package/lib/fsa-to-node/worker/FsaNodeSyncWorker.d.ts +0 -20
- package/lib/fsa-to-node/worker/FsaNodeSyncWorker.js +0 -178
- package/lib/fsa-to-node/worker/FsaNodeSyncWorker.js.map +0 -1
- package/lib/fsa-to-node/worker/SyncMessenger.d.ts +0 -24
- package/lib/fsa-to-node/worker/SyncMessenger.js +0 -72
- package/lib/fsa-to-node/worker/SyncMessenger.js.map +0 -1
- package/lib/fsa-to-node/worker/constants.d.ts +0 -8
- package/lib/fsa-to-node/worker/constants.js +0 -3
- package/lib/fsa-to-node/worker/constants.js.map +0 -1
- package/lib/fsa-to-node/worker/types.d.ts +0 -17
- package/lib/fsa-to-node/worker/types.js +0 -3
- package/lib/fsa-to-node/worker/types.js.map +0 -1
- package/lib/node/Dir.d.ts +0 -26
- package/lib/node/Dir.js +0 -186
- package/lib/node/Dir.js.map +0 -1
- package/lib/node/Dirent.d.ts +0 -26
- package/lib/node/Dirent.js +0 -57
- package/lib/node/Dirent.js.map +0 -1
- package/lib/node/FileHandle.d.ts +0 -52
- package/lib/node/FileHandle.js +0 -189
- package/lib/node/FileHandle.js.map +0 -1
- package/lib/node/FsPromises.d.ts +0 -91
- package/lib/node/FsPromises.js +0 -161
- package/lib/node/FsPromises.js.map +0 -1
- package/lib/node/StatFs.d.ts +0 -19
- package/lib/node/StatFs.js +0 -34
- package/lib/node/StatFs.js.map +0 -1
- package/lib/node/Stats.d.ts +0 -41
- package/lib/node/Stats.js +0 -72
- package/lib/node/Stats.js.map +0 -1
- package/lib/node/constants.d.ts +0 -41
- package/lib/node/constants.js +0 -57
- package/lib/node/constants.js.map +0 -1
- package/lib/node/glob.d.ts +0 -5
- package/lib/node/glob.js +0 -94
- package/lib/node/glob.js.map +0 -1
- package/lib/node/lists/fsCallbackApiList.d.ts +0 -2
- package/lib/node/lists/fsCallbackApiList.js +0 -55
- package/lib/node/lists/fsCallbackApiList.js.map +0 -1
- package/lib/node/lists/fsCommonObjectsList.d.ts +0 -2
- package/lib/node/lists/fsCommonObjectsList.js +0 -19
- package/lib/node/lists/fsCommonObjectsList.js.map +0 -1
- package/lib/node/lists/fsSynchronousApiList.d.ts +0 -2
- package/lib/node/lists/fsSynchronousApiList.js +0 -49
- package/lib/node/lists/fsSynchronousApiList.js.map +0 -1
- package/lib/node/options.d.ts +0 -27
- package/lib/node/options.js +0 -112
- package/lib/node/options.js.map +0 -1
- package/lib/node/types/FsCallbackApi.d.ts +0 -143
- package/lib/node/types/FsCallbackApi.js +0 -3
- package/lib/node/types/FsCallbackApi.js.map +0 -1
- package/lib/node/types/FsCommonObjects.d.ts +0 -17
- package/lib/node/types/FsCommonObjects.js +0 -3
- package/lib/node/types/FsCommonObjects.js.map +0 -1
- package/lib/node/types/FsPromisesApi.d.ts +0 -41
- package/lib/node/types/FsPromisesApi.js +0 -3
- package/lib/node/types/FsPromisesApi.js.map +0 -1
- package/lib/node/types/FsSynchronousApi.d.ts +0 -114
- package/lib/node/types/FsSynchronousApi.js +0 -3
- package/lib/node/types/FsSynchronousApi.js.map +0 -1
- package/lib/node/types/index.d.ts +0 -7
- package/lib/node/types/index.js +0 -3
- package/lib/node/types/index.js.map +0 -1
- package/lib/node/types/misc.d.ts +0 -157
- package/lib/node/types/misc.js +0 -3
- package/lib/node/types/misc.js.map +0 -1
- package/lib/node/types/options.d.ts +0 -191
- package/lib/node/types/options.js +0 -3
- package/lib/node/types/options.js.map +0 -1
- package/lib/node/util.d.ts +0 -21
- package/lib/node/util.js +0 -297
- package/lib/node/util.js.map +0 -1
- package/lib/node/volume.d.ts +0 -395
- package/lib/node/volume.js +0 -1641
- package/lib/node/volume.js.map +0 -1
- package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.d.ts +0 -72
- package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.js +0 -217
- package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.js.map +0 -1
- package/lib/node-to-fsa/NodeFileSystemFileHandle.d.ts +0 -28
- package/lib/node-to-fsa/NodeFileSystemFileHandle.js +0 -70
- package/lib/node-to-fsa/NodeFileSystemFileHandle.js.map +0 -1
- package/lib/node-to-fsa/NodeFileSystemHandle.d.ts +0 -37
- package/lib/node-to-fsa/NodeFileSystemHandle.js +0 -68
- package/lib/node-to-fsa/NodeFileSystemHandle.js.map +0 -1
- package/lib/node-to-fsa/NodeFileSystemSyncAccessHandle.d.ts +0 -42
- package/lib/node-to-fsa/NodeFileSystemSyncAccessHandle.js +0 -97
- package/lib/node-to-fsa/NodeFileSystemSyncAccessHandle.js.map +0 -1
- package/lib/node-to-fsa/NodeFileSystemWritableFileStream.d.ts +0 -56
- package/lib/node-to-fsa/NodeFileSystemWritableFileStream.js +0 -191
- package/lib/node-to-fsa/NodeFileSystemWritableFileStream.js.map +0 -1
- package/lib/node-to-fsa/NodePermissionStatus.d.ts +0 -8
- package/lib/node-to-fsa/NodePermissionStatus.js +0 -14
- package/lib/node-to-fsa/NodePermissionStatus.js.map +0 -1
- package/lib/node-to-fsa/types.d.ts +0 -18
- package/lib/node-to-fsa/types.js +0 -3
- package/lib/node-to-fsa/types.js.map +0 -1
- package/lib/node-to-fsa/util.d.ts +0 -12
- package/lib/node-to-fsa/util.js +0 -45
- package/lib/node-to-fsa/util.js.map +0 -1
- package/lib/node.d.ts +0 -3
- package/lib/node.js +0 -10
- package/lib/node.js.map +0 -1
- package/lib/print/index.d.ts +0 -9
- package/lib/print/index.js +0 -49
- package/lib/print/index.js.map +0 -1
- package/lib/process.d.ts +0 -11
- package/lib/process.js +0 -40
- package/lib/process.js.map +0 -1
- package/lib/queueMicrotask.d.ts +0 -2
- package/lib/queueMicrotask.js +0 -6
- package/lib/queueMicrotask.js.map +0 -1
- package/lib/snapshot/async.d.ts +0 -3
- package/lib/snapshot/async.js +0 -59
- package/lib/snapshot/async.js.map +0 -1
- package/lib/snapshot/binary.d.ts +0 -6
- package/lib/snapshot/binary.js +0 -31
- package/lib/snapshot/binary.js.map +0 -1
- package/lib/snapshot/constants.d.ts +0 -5
- package/lib/snapshot/constants.js +0 -3
- package/lib/snapshot/constants.js.map +0 -1
- package/lib/snapshot/index.d.ts +0 -5
- package/lib/snapshot/index.js +0 -8
- package/lib/snapshot/index.js.map +0 -1
- package/lib/snapshot/json.d.ts +0 -10
- package/lib/snapshot/json.js +0 -31
- package/lib/snapshot/json.js.map +0 -1
- package/lib/snapshot/shared.d.ts +0 -2
- package/lib/snapshot/shared.js +0 -6
- package/lib/snapshot/shared.js.map +0 -1
- package/lib/snapshot/sync.d.ts +0 -3
- package/lib/snapshot/sync.js +0 -59
- package/lib/snapshot/sync.js.map +0 -1
- package/lib/snapshot/types.d.ts +0 -30
- package/lib/snapshot/types.js +0 -3
- package/lib/snapshot/types.js.map +0 -1
- package/lib/vendor/node/buffer.d.ts +0 -1
- package/lib/vendor/node/buffer.js +0 -6
- package/lib/vendor/node/buffer.js.map +0 -1
- package/lib/vendor/node/events.d.ts +0 -1
- package/lib/vendor/node/events.js +0 -6
- package/lib/vendor/node/events.js.map +0 -1
- package/lib/vendor/node/fs.d.ts +0 -6
- package/lib/vendor/node/fs.js +0 -4
- package/lib/vendor/node/fs.js.map +0 -1
- package/lib/vendor/node/internal/buffer.d.ts +0 -9
- package/lib/vendor/node/internal/buffer.js +0 -13
- package/lib/vendor/node/internal/buffer.js.map +0 -1
- package/lib/vendor/node/internal/errors.d.ts +0 -31
- package/lib/vendor/node/internal/errors.js +0 -77
- package/lib/vendor/node/internal/errors.js.map +0 -1
- package/lib/vendor/node/path.d.ts +0 -1
- package/lib/vendor/node/path.js +0 -14
- package/lib/vendor/node/path.js.map +0 -1
- package/lib/vendor/node/stream.d.ts +0 -1
- package/lib/vendor/node/stream.js +0 -7
- package/lib/vendor/node/stream.js.map +0 -1
- package/lib/vendor/node/url.d.ts +0 -1
- package/lib/vendor/node/url.js +0 -6
- package/lib/vendor/node/url.js.map +0 -1
- package/lib/vendor/node/util.d.ts +0 -20
- package/lib/vendor/node/util.js +0 -112
- package/lib/vendor/node/util.js.map +0 -1
- package/src/node-to-fsa/README.md +0 -5
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/fsa-to-node/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { IFileSystemDirectoryHandle } from '../fsa/types';
|
|
2
|
-
import type { FsLocation } from './types';
|
|
3
|
-
export declare const pathToLocation: (path: string) => FsLocation;
|
|
4
|
-
export declare const testDirectoryIsWritable: (dir: IFileSystemDirectoryHandle) => Promise<boolean>;
|
package/lib/fsa-to-node/util.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.testDirectoryIsWritable = exports.pathToLocation = void 0;
|
|
4
|
-
const pathToLocation = (path) => {
|
|
5
|
-
if (path[0] === "/" /* FsaToNodeConstants.Separator */)
|
|
6
|
-
path = path.slice(1);
|
|
7
|
-
if (path[path.length - 1] === "/" /* FsaToNodeConstants.Separator */)
|
|
8
|
-
path = path.slice(0, -1);
|
|
9
|
-
const lastSlashIndex = path.lastIndexOf("/" /* FsaToNodeConstants.Separator */);
|
|
10
|
-
if (lastSlashIndex === -1)
|
|
11
|
-
return [[], path];
|
|
12
|
-
const file = path.slice(lastSlashIndex + 1);
|
|
13
|
-
const folder = path.slice(0, lastSlashIndex).split("/" /* FsaToNodeConstants.Separator */);
|
|
14
|
-
return [folder, file];
|
|
15
|
-
};
|
|
16
|
-
exports.pathToLocation = pathToLocation;
|
|
17
|
-
const testDirectoryIsWritable = async (dir) => {
|
|
18
|
-
const testFileName = '__memfs_writable_test_file_' + Math.random().toString(36).slice(2) + Date.now();
|
|
19
|
-
try {
|
|
20
|
-
await dir.getFileHandle(testFileName, { create: true });
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
finally {
|
|
27
|
-
try {
|
|
28
|
-
await dir.removeEntry(testFileName);
|
|
29
|
-
}
|
|
30
|
-
catch (e) { }
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
exports.testDirectoryIsWritable = testDirectoryIsWritable;
|
|
34
|
-
//# sourceMappingURL=util.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/fsa-to-node/util.ts"],"names":[],"mappings":";;;AAIO,MAAM,cAAc,GAAG,CAAC,IAAY,EAAc,EAAE;IACzD,IAAI,IAAI,CAAC,CAAC,CAAC,2CAAiC;QAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,2CAAiC;QAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACrF,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,wCAA8B,CAAC;IACtE,IAAI,cAAc,KAAK,CAAC,CAAC;QAAE,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,KAAK,wCAA8B,CAAC;IACjF,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACxB,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AAEK,MAAM,uBAAuB,GAAG,KAAK,EAAE,GAA+B,EAAoB,EAAE;IACjG,MAAM,YAAY,GAAG,6BAA6B,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACtG,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,aAAa,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;IAChB,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,uBAAuB,2BAYlC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SyncMessenger } from './SyncMessenger';
|
|
2
|
-
import type * as fsa from '../../fsa/types';
|
|
3
|
-
import type { FsaNodeSyncAdapter, FsaNodeSyncAdapterApi } from '../types';
|
|
4
|
-
export declare class FsaNodeSyncAdapterWorker implements FsaNodeSyncAdapter {
|
|
5
|
-
protected readonly messenger: SyncMessenger;
|
|
6
|
-
protected readonly root: fsa.IFileSystemDirectoryHandle;
|
|
7
|
-
static start(url: string, dir: fsa.IFileSystemDirectoryHandle | Promise<fsa.IFileSystemDirectoryHandle>): Promise<FsaNodeSyncAdapterWorker>;
|
|
8
|
-
constructor(messenger: SyncMessenger, root: fsa.IFileSystemDirectoryHandle);
|
|
9
|
-
call<K extends keyof FsaNodeSyncAdapterApi>(method: K, payload: Parameters<FsaNodeSyncAdapterApi[K]>[0]): ReturnType<FsaNodeSyncAdapterApi[K]>;
|
|
10
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FsaNodeSyncAdapterWorker = void 0;
|
|
4
|
-
const Defer_1 = require("thingies/lib/Defer");
|
|
5
|
-
const SyncMessenger_1 = require("./SyncMessenger");
|
|
6
|
-
const json_1 = require("../json");
|
|
7
|
-
let rootId = 0;
|
|
8
|
-
class FsaNodeSyncAdapterWorker {
|
|
9
|
-
static async start(url, dir) {
|
|
10
|
-
const worker = new Worker(url);
|
|
11
|
-
const future = new Defer_1.Defer();
|
|
12
|
-
let id = rootId++;
|
|
13
|
-
let messenger = undefined;
|
|
14
|
-
const _dir = await dir;
|
|
15
|
-
worker.onmessage = e => {
|
|
16
|
-
const data = e.data;
|
|
17
|
-
if (!Array.isArray(data))
|
|
18
|
-
return;
|
|
19
|
-
const msg = data;
|
|
20
|
-
const code = msg[0];
|
|
21
|
-
switch (code) {
|
|
22
|
-
case 0 /* FsaNodeWorkerMessageCode.Init */: {
|
|
23
|
-
const [, sab] = msg;
|
|
24
|
-
messenger = new SyncMessenger_1.SyncMessenger(sab);
|
|
25
|
-
const setRootMessage = [1 /* FsaNodeWorkerMessageCode.SetRoot */, id, _dir];
|
|
26
|
-
worker.postMessage(setRootMessage);
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
case 2 /* FsaNodeWorkerMessageCode.RootSet */: {
|
|
30
|
-
const [, rootId] = msg;
|
|
31
|
-
if (id !== rootId)
|
|
32
|
-
return;
|
|
33
|
-
const adapter = new FsaNodeSyncAdapterWorker(messenger, _dir);
|
|
34
|
-
future.resolve(adapter);
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
return await future.promise;
|
|
40
|
-
}
|
|
41
|
-
constructor(messenger, root) {
|
|
42
|
-
this.messenger = messenger;
|
|
43
|
-
this.root = root;
|
|
44
|
-
}
|
|
45
|
-
call(method, payload) {
|
|
46
|
-
const request = [3 /* FsaNodeWorkerMessageCode.Request */, method, payload];
|
|
47
|
-
const encoded = json_1.encoder.encode(request);
|
|
48
|
-
const encodedResponse = this.messenger.callSync(encoded);
|
|
49
|
-
const [code, data] = json_1.decoder.decode(encodedResponse);
|
|
50
|
-
switch (code) {
|
|
51
|
-
case 4 /* FsaNodeWorkerMessageCode.Response */:
|
|
52
|
-
return data;
|
|
53
|
-
case 5 /* FsaNodeWorkerMessageCode.ResponseError */:
|
|
54
|
-
throw data;
|
|
55
|
-
default: {
|
|
56
|
-
throw new Error('Invalid response message code');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.FsaNodeSyncAdapterWorker = FsaNodeSyncAdapterWorker;
|
|
62
|
-
//# sourceMappingURL=FsaNodeSyncAdapterWorker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FsaNodeSyncAdapterWorker.js","sourceRoot":"","sources":["../../../src/fsa-to-node/worker/FsaNodeSyncAdapterWorker.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAE3C,mDAAgD;AAChD,kCAA2C;AAa3C,IAAI,MAAM,GAAG,CAAC,CAAC;AAEf,MAAa,wBAAwB;IAC5B,MAAM,CAAC,KAAK,CAAC,KAAK,CACvB,GAAW,EACX,GAA6E;QAE7E,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,aAAK,EAA4B,CAAC;QACrD,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;QAClB,IAAI,SAAS,GAA8B,SAAS,CAAC;QACrD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC;QACvB,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE;YACrB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;YACpB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBAAE,OAAO;YACjC,MAAM,GAAG,GAAG,IAAwB,CAAC;YACrC,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAA6B,CAAC;YAChD,QAAQ,IAAI,EAAE,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AAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA3DD,4DA2DC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AsyncCallback, SyncMessenger } from './SyncMessenger';
|
|
2
|
-
import { FsaNodeFs } from '../FsaNodeFs';
|
|
3
|
-
import type * as fsa from '../../fsa/types';
|
|
4
|
-
import type { FsaNodeWorkerMsg } from './types';
|
|
5
|
-
import type { FsaNodeSyncAdapterApi } from '../types';
|
|
6
|
-
export declare class FsaNodeSyncWorker {
|
|
7
|
-
protected readonly sab: SharedArrayBuffer;
|
|
8
|
-
protected readonly messenger: SyncMessenger;
|
|
9
|
-
protected root: fsa.IFileSystemDirectoryHandle;
|
|
10
|
-
protected fs: FsaNodeFs;
|
|
11
|
-
start(): void;
|
|
12
|
-
protected onPostMessage: (msg: FsaNodeWorkerMsg) => void;
|
|
13
|
-
protected readonly onRequest: AsyncCallback;
|
|
14
|
-
protected getDir(path: string[], create: boolean, funcName?: string): Promise<fsa.IFileSystemDirectoryHandle>;
|
|
15
|
-
protected getFile(path: string[], name: string, funcName?: string, create?: boolean): Promise<fsa.IFileSystemFileHandle>;
|
|
16
|
-
protected getFileOrDir(path: string[], name: string, funcName?: string, create?: boolean): Promise<fsa.IFileSystemFileHandle | fsa.IFileSystemDirectoryHandle>;
|
|
17
|
-
protected handlers: {
|
|
18
|
-
[K in keyof FsaNodeSyncAdapterApi]: (request: Parameters<FsaNodeSyncAdapterApi[K]>[0]) => Promise<ReturnType<FsaNodeSyncAdapterApi[K]>>;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FsaNodeSyncWorker = void 0;
|
|
4
|
-
const SyncMessenger_1 = require("./SyncMessenger");
|
|
5
|
-
const FsaNodeFs_1 = require("../FsaNodeFs");
|
|
6
|
-
const json_1 = require("../json");
|
|
7
|
-
class FsaNodeSyncWorker {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.sab = new SharedArrayBuffer(1024 * 1024);
|
|
10
|
-
this.messenger = new SyncMessenger_1.SyncMessenger(this.sab);
|
|
11
|
-
this.onPostMessage = (msg) => {
|
|
12
|
-
switch (msg[0]) {
|
|
13
|
-
case 1 /* FsaNodeWorkerMessageCode.SetRoot */: {
|
|
14
|
-
const [, id, dir] = msg;
|
|
15
|
-
this.root = dir;
|
|
16
|
-
this.fs = new FsaNodeFs_1.FsaNodeFs(this.root);
|
|
17
|
-
const response = [2 /* FsaNodeWorkerMessageCode.RootSet */, id];
|
|
18
|
-
postMessage(response);
|
|
19
|
-
this.messenger.serveAsync(this.onRequest);
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
this.onRequest = async (request) => {
|
|
25
|
-
try {
|
|
26
|
-
const message = json_1.decoder.decode(request);
|
|
27
|
-
if (!Array.isArray(message))
|
|
28
|
-
throw new Error('Invalid message format');
|
|
29
|
-
const code = message[0];
|
|
30
|
-
if (code !== 3 /* FsaNodeWorkerMessageCode.Request */)
|
|
31
|
-
throw new Error('Invalid message code');
|
|
32
|
-
const [, method, payload] = message;
|
|
33
|
-
const handler = this.handlers[method];
|
|
34
|
-
if (!handler)
|
|
35
|
-
throw new Error(`Unknown method ${method}`);
|
|
36
|
-
const response = await handler(payload);
|
|
37
|
-
return json_1.encoder.encode([4 /* FsaNodeWorkerMessageCode.Response */, response]);
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
const message = err && typeof err === 'object' && err.message ? err.message : 'Unknown error';
|
|
41
|
-
const error = { message };
|
|
42
|
-
if (err && typeof err === 'object' && (err.code || err.name))
|
|
43
|
-
error.code = err.code || err.name;
|
|
44
|
-
return json_1.encoder.encode([5 /* FsaNodeWorkerMessageCode.ResponseError */, error]);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
this.handlers = {
|
|
48
|
-
stat: async (location) => {
|
|
49
|
-
const handle = await this.getFileOrDir(location[0], location[1], 'statSync');
|
|
50
|
-
return {
|
|
51
|
-
kind: handle.kind,
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
access: async ([filename, mode]) => {
|
|
55
|
-
await this.fs.promises.access(filename, mode);
|
|
56
|
-
},
|
|
57
|
-
readFile: async ([filename, opts]) => {
|
|
58
|
-
const buf = (await this.fs.promises.readFile(filename, { ...opts, encoding: 'buffer' }));
|
|
59
|
-
const uint8 = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
60
|
-
return uint8;
|
|
61
|
-
},
|
|
62
|
-
writeFile: async ([filename, data, opts]) => {
|
|
63
|
-
await this.fs.promises.writeFile(filename, data, { ...opts, encoding: 'buffer' });
|
|
64
|
-
},
|
|
65
|
-
appendFile: async ([filename, data, opts]) => {
|
|
66
|
-
await this.fs.promises.appendFile(filename, data, { ...opts, encoding: 'buffer' });
|
|
67
|
-
},
|
|
68
|
-
copy: async ([src, dst, flags]) => {
|
|
69
|
-
await this.fs.promises.copyFile(src, dst, flags);
|
|
70
|
-
},
|
|
71
|
-
move: async ([src, dst]) => {
|
|
72
|
-
await this.fs.promises.rename(src, dst);
|
|
73
|
-
},
|
|
74
|
-
rmdir: async ([filename, options]) => {
|
|
75
|
-
await this.fs.promises.rmdir(filename, options);
|
|
76
|
-
},
|
|
77
|
-
rm: async ([filename, options]) => {
|
|
78
|
-
await this.fs.promises.rm(filename, options);
|
|
79
|
-
},
|
|
80
|
-
mkdir: async ([filename, options]) => {
|
|
81
|
-
return await this.fs.promises.mkdir(filename, options);
|
|
82
|
-
},
|
|
83
|
-
mkdtemp: async ([filename]) => {
|
|
84
|
-
return (await this.fs.promises.mkdtemp(filename, { encoding: 'utf8' }));
|
|
85
|
-
},
|
|
86
|
-
trunc: async ([filename, len]) => {
|
|
87
|
-
await this.fs.promises.truncate(filename, len);
|
|
88
|
-
},
|
|
89
|
-
unlink: async ([filename]) => {
|
|
90
|
-
await this.fs.promises.unlink(filename);
|
|
91
|
-
},
|
|
92
|
-
readdir: async ([filename]) => {
|
|
93
|
-
const list = (await this.fs.promises.readdir(filename, { withFileTypes: true, encoding: 'utf8' }));
|
|
94
|
-
const res = list.map(entry => ({
|
|
95
|
-
kind: entry.isDirectory() ? 'directory' : 'file',
|
|
96
|
-
name: entry.name,
|
|
97
|
-
}));
|
|
98
|
-
return res;
|
|
99
|
-
},
|
|
100
|
-
read: async ([filename, position, length]) => {
|
|
101
|
-
let uint8 = new Uint8Array(length);
|
|
102
|
-
const handle = await this.fs.promises.open(filename, 'r');
|
|
103
|
-
const bytesRead = await new Promise((resolve, reject) => {
|
|
104
|
-
this.fs.read(handle.fd, uint8, 0, length, position, (err, bytesRead) => {
|
|
105
|
-
if (err)
|
|
106
|
-
return reject(err);
|
|
107
|
-
resolve(bytesRead || length);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
if (bytesRead < length)
|
|
111
|
-
uint8 = uint8.slice(0, bytesRead);
|
|
112
|
-
return uint8;
|
|
113
|
-
},
|
|
114
|
-
write: async ([filename, data, position]) => {
|
|
115
|
-
const handle = await this.fs.promises.open(filename, 'a');
|
|
116
|
-
const { bytesWritten } = await handle.write(data, 0, data.length, position || undefined);
|
|
117
|
-
return bytesWritten;
|
|
118
|
-
},
|
|
119
|
-
open: async ([filename, flags, mode]) => {
|
|
120
|
-
const handle = await this.fs.promises.open(filename, flags, mode);
|
|
121
|
-
const file = await this.fs.__getFileById(handle.fd);
|
|
122
|
-
await handle.close();
|
|
123
|
-
return file;
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
start() {
|
|
128
|
-
onmessage = e => {
|
|
129
|
-
if (!Array.isArray(e.data))
|
|
130
|
-
return;
|
|
131
|
-
this.onPostMessage(e.data);
|
|
132
|
-
};
|
|
133
|
-
const initMsg = [0 /* FsaNodeWorkerMessageCode.Init */, this.sab];
|
|
134
|
-
postMessage(initMsg);
|
|
135
|
-
}
|
|
136
|
-
async getDir(path, create, funcName) {
|
|
137
|
-
let curr = this.root;
|
|
138
|
-
const options = { create };
|
|
139
|
-
try {
|
|
140
|
-
for (const name of path) {
|
|
141
|
-
curr = await curr.getDirectoryHandle(name, options);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
// if (error && typeof error === 'object' && error.name === 'TypeMismatchError')
|
|
146
|
-
// throw createError('ENOTDIR', funcName, path.join(FsaToNodeConstants.Separator));
|
|
147
|
-
throw error;
|
|
148
|
-
}
|
|
149
|
-
return curr;
|
|
150
|
-
}
|
|
151
|
-
async getFile(path, name, funcName, create) {
|
|
152
|
-
const dir = await this.getDir(path, false, funcName);
|
|
153
|
-
const file = await dir.getFileHandle(name, { create });
|
|
154
|
-
return file;
|
|
155
|
-
}
|
|
156
|
-
async getFileOrDir(path, name, funcName, create) {
|
|
157
|
-
const dir = await this.getDir(path, false, funcName);
|
|
158
|
-
if (!name)
|
|
159
|
-
return dir;
|
|
160
|
-
try {
|
|
161
|
-
const file = await dir.getFileHandle(name);
|
|
162
|
-
return file;
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
if (error && typeof error === 'object') {
|
|
166
|
-
switch (error.name) {
|
|
167
|
-
case 'TypeMismatchError':
|
|
168
|
-
return await dir.getDirectoryHandle(name);
|
|
169
|
-
// case 'NotFoundError':
|
|
170
|
-
// throw createError('ENOENT', funcName, path.join(FsaToNodeConstants.Separator));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
throw error;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
exports.FsaNodeSyncWorker = FsaNodeSyncWorker;
|
|
178
|
-
//# sourceMappingURL=FsaNodeSyncWorker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FsaNodeSyncWorker.js","sourceRoot":"","sources":["../../../src/f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AAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;oBAC5C,wBAAwB;oBACxB,oFAAoF;gBACtF,CAAC;YACH,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CAsFF;AAtLD,8CAsLC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export type AsyncCallback = (request: Uint8Array) => Promise<Uint8Array>;
|
|
2
|
-
/**
|
|
3
|
-
* `SyncMessenger` allows to execute asynchronous code synchronously. The
|
|
4
|
-
* asynchronous code is executed in a Worker thread, while the main thread is
|
|
5
|
-
* blocked until the asynchronous code is finished.
|
|
6
|
-
*
|
|
7
|
-
* First four 4-byte words is the header, where the first word is used for Atomics
|
|
8
|
-
* notifications. The second word is used for spin-locking the main thread until
|
|
9
|
-
* the asynchronous code is finished. The third word is used to specify payload
|
|
10
|
-
* length. The fourth word is currently unused.
|
|
11
|
-
*
|
|
12
|
-
* The maximum payload size is the size of the SharedArrayBuffer minus the
|
|
13
|
-
* header size.
|
|
14
|
-
*/
|
|
15
|
-
export declare class SyncMessenger {
|
|
16
|
-
protected readonly sab: SharedArrayBuffer;
|
|
17
|
-
protected readonly int32: Int32Array;
|
|
18
|
-
protected readonly uint8: Uint8Array;
|
|
19
|
-
protected readonly headerSize: any;
|
|
20
|
-
protected readonly dataSize: any;
|
|
21
|
-
constructor(sab: SharedArrayBuffer);
|
|
22
|
-
callSync(data: Uint8Array): Uint8Array;
|
|
23
|
-
serveAsync(callback: AsyncCallback): void;
|
|
24
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SyncMessenger = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @param condition Condition to wait for, when true, the function returns.
|
|
6
|
-
* @param ms Maximum time to wait in milliseconds.
|
|
7
|
-
*/
|
|
8
|
-
const sleepUntil = (condition, ms = 100) => {
|
|
9
|
-
const start = Date.now();
|
|
10
|
-
while (!condition()) {
|
|
11
|
-
const now = Date.now();
|
|
12
|
-
if (now - start > ms)
|
|
13
|
-
throw new Error('Timeout');
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* `SyncMessenger` allows to execute asynchronous code synchronously. The
|
|
18
|
-
* asynchronous code is executed in a Worker thread, while the main thread is
|
|
19
|
-
* blocked until the asynchronous code is finished.
|
|
20
|
-
*
|
|
21
|
-
* First four 4-byte words is the header, where the first word is used for Atomics
|
|
22
|
-
* notifications. The second word is used for spin-locking the main thread until
|
|
23
|
-
* the asynchronous code is finished. The third word is used to specify payload
|
|
24
|
-
* length. The fourth word is currently unused.
|
|
25
|
-
*
|
|
26
|
-
* The maximum payload size is the size of the SharedArrayBuffer minus the
|
|
27
|
-
* header size.
|
|
28
|
-
*/
|
|
29
|
-
class SyncMessenger {
|
|
30
|
-
constructor(sab) {
|
|
31
|
-
this.sab = sab;
|
|
32
|
-
this.int32 = new Int32Array(sab);
|
|
33
|
-
this.uint8 = new Uint8Array(sab);
|
|
34
|
-
this.headerSize = 4 * 4;
|
|
35
|
-
this.dataSize = sab.byteLength - this.headerSize;
|
|
36
|
-
}
|
|
37
|
-
callSync(data) {
|
|
38
|
-
const requestLength = data.length;
|
|
39
|
-
const headerSize = this.headerSize;
|
|
40
|
-
const int32 = this.int32;
|
|
41
|
-
int32[1] = 0;
|
|
42
|
-
int32[2] = requestLength;
|
|
43
|
-
this.uint8.set(data, headerSize);
|
|
44
|
-
Atomics.notify(int32, 0);
|
|
45
|
-
sleepUntil(() => int32[1] === 1);
|
|
46
|
-
const responseLength = int32[2];
|
|
47
|
-
const response = this.uint8.slice(headerSize, headerSize + responseLength);
|
|
48
|
-
return response;
|
|
49
|
-
}
|
|
50
|
-
serveAsync(callback) {
|
|
51
|
-
const headerSize = this.headerSize;
|
|
52
|
-
(async () => {
|
|
53
|
-
try {
|
|
54
|
-
const int32 = this.int32;
|
|
55
|
-
const res = Atomics.wait(int32, 0, 0);
|
|
56
|
-
if (res !== 'ok')
|
|
57
|
-
throw new Error(`Unexpected Atomics.wait result: ${res}`);
|
|
58
|
-
const requestLength = this.int32[2];
|
|
59
|
-
const request = this.uint8.slice(headerSize, headerSize + requestLength);
|
|
60
|
-
const response = await callback(request);
|
|
61
|
-
const responseLength = response.length;
|
|
62
|
-
int32[2] = responseLength;
|
|
63
|
-
this.uint8.set(response, headerSize);
|
|
64
|
-
int32[1] = 1;
|
|
65
|
-
}
|
|
66
|
-
catch { }
|
|
67
|
-
this.serveAsync(callback);
|
|
68
|
-
})().catch(() => { });
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.SyncMessenger = SyncMessenger;
|
|
72
|
-
//# sourceMappingURL=SyncMessenger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SyncMessenger.js","sourceRoot":"","sources":["../../../src/fsa-to-node/worker/SyncMessenger.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,SAAwB,EAAE,KAAa,GAAG,EAAE,EAAE;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,GAAG,GAAG,KAAK,GAAG,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAa,aAAa;IAMxB,YAAsC,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QAC1D,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,CAAC,GAAG,CAAC,CAAC;QACx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K,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,GAAG,aAAa,CAAC,CAAC;gBACzE,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;gBACzC,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;gBACvC,KAAK,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC;gBAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;gBACrC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACf,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;YACV,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACvB,CAAC;CACF;AA7CD,sCA6CC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/fsa-to-node/worker/constants.ts"],"names":[],"mappings":""}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { IFileSystemDirectoryHandle } from '../../fsa/types';
|
|
2
|
-
import type { FsaNodeWorkerMessageCode } from './constants';
|
|
3
|
-
export type FsaNodeWorkerMsgInit = [type: FsaNodeWorkerMessageCode.Init, sab: SharedArrayBuffer];
|
|
4
|
-
export type FsaNodeWorkerMsgSetRoot = [
|
|
5
|
-
type: FsaNodeWorkerMessageCode.SetRoot,
|
|
6
|
-
id: number,
|
|
7
|
-
dir: IFileSystemDirectoryHandle
|
|
8
|
-
];
|
|
9
|
-
export type FsaNodeWorkerMsgRootSet = [type: FsaNodeWorkerMessageCode.RootSet, id: number];
|
|
10
|
-
export type FsaNodeWorkerMsgRequest = [type: FsaNodeWorkerMessageCode.Request, method: string, data: unknown];
|
|
11
|
-
export type FsaNodeWorkerMsgResponse = [type: FsaNodeWorkerMessageCode.Response, data: unknown];
|
|
12
|
-
export type FsaNodeWorkerMsgResponseError = [type: FsaNodeWorkerMessageCode.ResponseError, data: unknown];
|
|
13
|
-
export interface FsaNodeWorkerError {
|
|
14
|
-
message: string;
|
|
15
|
-
code?: string;
|
|
16
|
-
}
|
|
17
|
-
export type FsaNodeWorkerMsg = FsaNodeWorkerMsgInit | FsaNodeWorkerMsgSetRoot | FsaNodeWorkerMsgRootSet | FsaNodeWorkerMsgRequest | FsaNodeWorkerMsgResponse | FsaNodeWorkerMsgResponseError;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/fsa-to-node/worker/types.ts"],"names":[],"mappings":""}
|
package/lib/node/Dir.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Link } from '../node';
|
|
2
|
-
import * as opts from './types/options';
|
|
3
|
-
import type { IDir, IDirent } from './types/misc';
|
|
4
|
-
/**
|
|
5
|
-
* A directory stream, like `fs.Dir`.
|
|
6
|
-
*/
|
|
7
|
-
export declare class Dir implements IDir {
|
|
8
|
-
protected readonly link: Link;
|
|
9
|
-
protected options: opts.IOpendirOptions;
|
|
10
|
-
private iteratorInfo;
|
|
11
|
-
private closed;
|
|
12
|
-
private operationQueue;
|
|
13
|
-
constructor(link: Link, options: opts.IOpendirOptions);
|
|
14
|
-
private closeBase;
|
|
15
|
-
private readBase;
|
|
16
|
-
readonly path: string;
|
|
17
|
-
close(): Promise<void>;
|
|
18
|
-
close(callback?: (err?: Error) => void): void;
|
|
19
|
-
closeSync(): void;
|
|
20
|
-
read(): Promise<IDirent | null>;
|
|
21
|
-
read(callback?: (err: Error | null, dir?: IDirent | null) => void): void;
|
|
22
|
-
readSync(): IDirent | null;
|
|
23
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<IDirent>;
|
|
24
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
25
|
-
[Symbol.dispose](): void;
|
|
26
|
-
}
|