| 987 | * file system. |
| 988 | */ |
| 989 | export default class OverlayFS extends LockedFS<UnlockedOverlayFS> { |
| 990 | public static readonly Name = "OverlayFS"; |
| 991 | |
| 992 | public static readonly Options: FileSystemOptions = { |
| 993 | writable: { |
| 994 | type: "object", |
| 995 | description: "The file system to write modified files to." |
| 996 | }, |
| 997 | readable: { |
| 998 | type: "object", |
| 999 | description: "The file system that initially populates this file system." |
| 1000 | } |
| 1001 | }; |
| 1002 | |
| 1003 | /** |
| 1004 | * Constructs and initializes an OverlayFS instance with the given options. |
| 1005 | */ |
| 1006 | public static Create(opts: OverlayFSOptions, cb: BFSCallback<OverlayFS>): void { |
| 1007 | try { |
| 1008 | const fs = new OverlayFS(opts.writable, opts.readable, false); |
| 1009 | fs.initialize((e?) => { |
| 1010 | cb(e, fs); |
| 1011 | }, false); |
| 1012 | } catch (e) { |
| 1013 | cb(e); |
| 1014 | } |
| 1015 | } |
| 1016 | public static isAvailable(): boolean { |
| 1017 | return UnlockedOverlayFS.isAvailable(); |
| 1018 | } |
| 1019 | |
| 1020 | /** |
| 1021 | * **Deprecated. Please use OverlayFS.Create() method instead.** |
| 1022 | * @param writable The file system to write modified files to. |
| 1023 | * @param readable The file system that initially populates this file system. |
| 1024 | */ |
| 1025 | constructor(writable: FileSystem, readable: FileSystem, deprecateMsg = true) { |
| 1026 | super(new UnlockedOverlayFS(writable, readable)); |
| 1027 | deprecationMessage(deprecateMsg, OverlayFS.Name, {readable: "readable file system", writable: "writable file system"}); |
| 1028 | } |
| 1029 | |
| 1030 | /** |
| 1031 | * **Deprecated. Please use OverlayFS.Create() to construct and initialize OverlayFS instances.** |
| 1032 | */ |
| 1033 | public initialize(cb: BFSOneArgCallback, deprecateMsg = true): void { |
| 1034 | if (deprecateMsg) { |
| 1035 | console.warn(`[OverlayFS] OverlayFS.initialize() is deprecated and will be removed in the next major release. Please use 'OverlayFS.Create({readable: readable file system instance, writable: writable file system instance}, cb)' to create and initialize OverlayFS instances.`); |
| 1036 | } |
| 1037 | super.initialize(cb); |
| 1038 | } |
| 1039 | |
| 1040 | public getOverlayedFileSystems(): { readable: FileSystem; writable: FileSystem; } { |
| 1041 | return super.getFSUnlocked().getOverlayedFileSystems(); |
| 1042 | } |
| 1043 | |
| 1044 | public unwrap(): UnlockedOverlayFS { |
| 1045 | return super.getFSUnlocked(); |
| 1046 | } |
nothing calls this directly
no outgoing calls
no test coverage detected