Type aliases
AliasFSOptions
AliasFSOptions<P>: object
Type parameters
ChangeFileOptions
ChangeFileOptions: Partial<object>
CopyOptions
CopyOptions: object
Type declaration
-
overwrite: boolean
-
stableSort: boolean
-
stableTime: boolean
CreateReadStreamOptions
CreateReadStreamOptions: Partial<object>
CreateWriteStreamOptions
CreateWriteStreamOptions: Partial<object>
CustomStatWatcherOptions
CustomStatWatcherOptions: object
Type declaration
-
Optional bigint?: undefined | false | true
CwdFSOptions
CwdFSOptions: object
Dirent
Dirent: Exclude<NodeDirent, "name"> & object
ExtractHintOptions
ExtractHintOptions: object
Type declaration
-
relevantExtensions: Set<string>
FSPath
FSPath<T>: T | number
Type parameters
Filename
Filename: string & object
JailFSOptions
JailFSOptions: object
LUTimes
LUTimes<P>: Array<[P, Date | number, Date | number]>
Type parameters
LazyFSFactory
LazyFSFactory<P>: function
Type parameters
MkdirOptions
MkdirOptions: Partial<object>
NativePath
NativePath: string & object
Operations
Operations: Array<function>
PortablePath
PortablePath: string & object
StatWatcher
StatWatcher: EventEmitter & object
SymlinkType
SymlinkType: "file" | "dir" | "junction"
VirtualFSOptions
VirtualFSOptions: object
WatchCallback
WatchCallback: function
Type declaration
-
- (eventType: string, filename: string): void
-
Parameters
-
eventType: string
-
filename: string
Returns void
WatchFileCallback
WatchFileCallback: function
Type declaration
-
- (current: Stats, previous: Stats): void
-
Parameters
-
current: Stats
-
previous: Stats
Returns void
WatchFileOptions
WatchFileOptions: Partial<object>
WatchOptions
WatchOptions: Partial<object> | string
WriteFileOptions
WriteFileOptions: Partial<object> | string
ZipBufferOptions
ZipBufferOptions: object
Type declaration
-
-
-
Optional readOnly?: undefined | false | true
-
Optional stats?: Stats
ZipCompression
ZipCompression: "mixed" | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
ZipOpenFSOptions
ZipOpenFSOptions: object
Type declaration
-
-
Optional filter?: RegExp | null
-
-
Optional maxAge?: undefined | number
-
Optional maxOpenFiles?: undefined | number
-
Optional readOnlyArchives?: undefined | false | true
-
Optional useCache?: undefined | false | true
Variables
Const DEFAULT_COMPRESSION_LEVEL
Const FILE_PARTS_REGEX
FILE_PARTS_REGEX: RegExp = /.*?(?<!\/)\.zip(?=\/|$)/
Const JAIL_ROOT
JAIL_ROOT: string & object = PortablePath.root
Const NUMBER_REGEXP
NUMBER_REGEXP: RegExp = /^[0-9]+$/
Const PORTABLE_PATH_REGEXP
PORTABLE_PATH_REGEXP: RegExp = /^\/([a-zA-Z]:.*)$/
Const S_IFDIR
S_IFDIR: 16384 = 16384
Const S_IFLNK
S_IFLNK: 40960 = 40960
Const S_IFMT
S_IFMT: 61440 = 61440
Const S_IFREG
S_IFREG: 32768 = 32768
Const UNC_PORTABLE_PATH_REGEXP
UNC_PORTABLE_PATH_REGEXP: RegExp = /^\/unc\/(\.dot\/)?(.*)$/
Const UNC_WINDOWS_PATH_REGEXP
UNC_WINDOWS_PATH_REGEXP: RegExp = /^\\\\(\.\\)?(.*)$/
Const VALID_COMPONENT
VALID_COMPONENT: RegExp = /^([^/]+-)?[a-f0-9]+$/
Const VIRTUAL_REGEXP
VIRTUAL_REGEXP: RegExp = /^(\/(?:[^/]+\/)*?\$\$virtual)((?:\/((?:[^/]+-)?[a-f0-9]+)(?:\/([^/]+))?)?((?:\/.*)?))$/
Const WINDOWS_PATH_REGEXP
WINDOWS_PATH_REGEXP: RegExp = /^([a-zA-Z]:.*)$/
Const ZIP_FD
ZIP_FD: 2147483648 = 2147483648
Const ZIP_FILE1
ZIP_FILE1: string & object = ppath.join(npath.toPortablePath(__dirname),`fixtures/foo.zip/foo.txt` as Filename)
Const ZIP_FILE2
ZIP_FILE2: string & object = ppath.join(npath.toPortablePath(__dirname),`fixtures/folder.zip/foo.zip/foo.txt` as Filename)
Let cleanExitRegistered
cleanExitRegistered: boolean = false
Const defaultTime
defaultTime: 315532800 = 315532800
Const statWatchersByFakeFS
stat
WatchersByFakeFS: WeakMap<FakeFS<string & object | string & object>, Map<string & object | string & object, CustomStatWatcher<string & object | string & object>>> = new WeakMap<FakeFS<Path>, Map<Path, CustomStatWatcher<Path>>>()
Const tmpdirs
tmpdirs: Set<string & object> = new Set<PortablePath>()
Const xfs
xfs
: XFS = Object.assign(new NodeFS(), {detachTemp(p: PortablePath) {tmpdirs.delete(p);},mktempSync<T>(this: XFS, cb?: (p: PortablePath) => T) {registerCleanExit();while (true) {const p = getTempName(`xfs-`);try {this.mkdirSync(p);} catch (error) {if (error.code === `EEXIST`) {continue;} else {throw error;}}const realP = this.realpathSync(p);tmpdirs.add(realP);if (typeof cb !== `undefined`) {try {return cb(realP);} finally {if (tmpdirs.has(realP)) {tmpdirs.delete(realP);try {this.removeSync(realP);} catch {// Too bad if there's an error}}}} else {return p;}}},async mktempPromise<T>(this: XFS, cb?: (p: PortablePath) => Promise<T>) {registerCleanExit();while (true) {const p = getTempName(`xfs-`);try {await this.mkdirPromise(p);} catch (error) {if (error.code === `EEXIST`) {continue;} else {throw error;}}const realP = await this.realpathPromise(p);tmpdirs.add(realP);if (typeof cb !== `undefined`) {try {return await cb(realP);} finally {if (tmpdirs.has(realP)) {tmpdirs.delete(realP);try {await this.removePromise(realP);} catch {// Too bad if there's an error}}}} else {return realP;}}},async rmtempPromise() {await Promise.all(Array.from(tmpdirs.values()).map(async p => {try {await xfs.removePromise(p, {maxRetries: 0});tmpdirs.delete(p);} catch {// Too bad if there's an error}}));},rmtempSync() {for (const p of tmpdirs) {try {xfs.removeSync(p);tmpdirs.delete(p);} catch {// Too bad if there's an error}}},})
Maximum age in ms. ZipFS instances are pruned from the cache if they aren't accessed within this amount of time.