-
Notifications
You must be signed in to change notification settings - Fork 0
/
browser-fs-dom.min.js.map
8 lines (8 loc) · 105 KB
/
browser-fs-dom.min.js.map
1
2
3
4
5
6
7
8
{
"version": 3,
"sourceRoot": "@browserfs/fs-dom/src",
"sources": ["external-global-plugin:@browserfs/core/ApiError.js", "external-global-plugin:@browserfs/core/cred.js", "external-global-plugin:@browserfs/core/file.js", "external-global-plugin:@browserfs/core/filesystem.js", "external-global-plugin:@browserfs/core/stats.js", "external-global-plugin:@browserfs/core/FileIndex.js", "external-global-plugin:@browserfs/core/backends/AsyncStore.js", "external-global-plugin:@browserfs/core/backends/SyncStore.js", "../src/index.ts", "../node_modules/@browserfs/core/dist/emulation/path.js", "../src/backends/FileSystemAccess.ts", "../node_modules/@browserfs/core/dist/ApiError.js", "../node_modules/@browserfs/core/dist/utils.js", "../node_modules/@browserfs/core/dist/backends/backend.js", "../src/backends/HTTPRequest.ts", "../src/fetch.ts", "../src/backends/IndexedDB.ts", "../src/backends/Storage.ts", "../src/utf16coder.ts", "../src/backends/Worker.ts"],
"sourcesContent": ["module.exports = BrowserFS", "module.exports = BrowserFS", "module.exports = BrowserFS", "module.exports = BrowserFS", "module.exports = BrowserFS", "module.exports = BrowserFS", "module.exports = BrowserFS", "module.exports = BrowserFS", "export * from './backends/FileSystemAccess.js';\nexport * from './backends/HTTPRequest.js';\nexport * from './backends/IndexedDB.js';\nexport * from './backends/Storage.js';\nexport * from './backends/Worker.js';\n", "/*\nCopyright Joyent, Inc. and other Node contributors.\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the\nfollowing conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\nNO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\nUSE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\nexport const cwd = '/';\nexport const sep = '/';\nfunction validateString(str, name) {\n if (typeof str != 'string') {\n throw new TypeError(`\"${name}\" is not a string`);\n }\n}\nfunction validateObject(str, name) {\n if (typeof str != 'object') {\n throw new TypeError(`\"${name}\" is not an object`);\n }\n}\n// Resolves . and .. elements in a path with directory names\nexport function normalizeString(path, allowAboveRoot) {\n let res = '';\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char = '\\x00';\n for (let i = 0; i <= path.length; ++i) {\n if (i < path.length) {\n char = path[i];\n }\n else if (char == '/') {\n break;\n }\n else {\n char = '/';\n }\n if (char == '/') {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n }\n else if (dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.at(-1) !== '.' || res.at(-2) !== '.') {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n }\n else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n else if (res.length !== 0) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? '/..' : '..';\n lastSegmentLength = 2;\n }\n }\n else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (char === '.' && dots !== -1) {\n ++dots;\n }\n else {\n dots = -1;\n }\n }\n return res;\n}\nexport function formatExt(ext) {\n return ext ? `${ext[0] === '.' ? '' : '.'}${ext}` : '';\n}\nexport function resolve(...args) {\n let resolvedPath = '';\n let resolvedAbsolute = false;\n for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n const path = i >= 0 ? args[i] : cwd;\n validateString(path, `paths[${i}]`);\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = path[0] === '/';\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);\n if (resolvedAbsolute) {\n return `/${resolvedPath}`;\n }\n return resolvedPath.length > 0 ? resolvedPath : '.';\n}\nexport function normalize(path) {\n validateString(path, 'path');\n if (path.length === 0)\n return '.';\n const isAbsolute = path[0] === '/';\n const trailingSeparator = path.at(-1) === '/';\n // Normalize the path\n path = normalizeString(path, !isAbsolute);\n if (path.length === 0) {\n if (isAbsolute)\n return '/';\n return trailingSeparator ? './' : '.';\n }\n if (trailingSeparator)\n path += '/';\n return isAbsolute ? `/${path}` : path;\n}\nexport function isAbsolute(path) {\n validateString(path, 'path');\n return path.length > 0 && path[0] === '/';\n}\nexport function join(...args) {\n if (args.length === 0)\n return '.';\n let joined;\n for (let i = 0; i < args.length; ++i) {\n const arg = args[i];\n validateString(arg, 'path');\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += `/${arg}`;\n }\n }\n if (joined === undefined)\n return '.';\n return normalize(joined);\n}\nexport function relative(from, to) {\n validateString(from, 'from');\n validateString(to, 'to');\n if (from === to)\n return '';\n // Trim leading forward slashes.\n from = resolve(from);\n to = resolve(to);\n if (from === to)\n return '';\n const fromStart = 1;\n const fromEnd = from.length;\n const fromLen = fromEnd - fromStart;\n const toStart = 1;\n const toLen = to.length - toStart;\n // Compare paths to find the longest common path from root\n const length = fromLen < toLen ? fromLen : toLen;\n let lastCommonSep = -1;\n let i = 0;\n for (; i < length; i++) {\n const fromCode = from[fromStart + i];\n if (fromCode !== to[toStart + i])\n break;\n else if (fromCode === '/')\n lastCommonSep = i;\n }\n if (i === length) {\n if (toLen > length) {\n if (to[toStart + i] === '/') {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n }\n if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n }\n else if (fromLen > length) {\n if (from[fromStart + i] === '/') {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n }\n else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo/bar'; to='/'\n lastCommonSep = 0;\n }\n }\n }\n let out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`.\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from[i] === '/') {\n out += out.length === 0 ? '..' : '/..';\n }\n }\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts.\n return `${out}${to.slice(toStart + lastCommonSep)}`;\n}\nexport function dirname(path) {\n validateString(path, 'path');\n if (path.length === 0)\n return '.';\n const hasRoot = path[0] === '/';\n let end = -1;\n let matchedSlash = true;\n for (let i = path.length - 1; i >= 1; --i) {\n if (path[i] === '/') {\n if (!matchedSlash) {\n end = i;\n break;\n }\n }\n else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n if (end === -1)\n return hasRoot ? '/' : '.';\n if (hasRoot && end === 1)\n return '//';\n return path.slice(0, end);\n}\nexport function basename(path, suffix) {\n if (suffix !== undefined)\n validateString(suffix, 'ext');\n validateString(path, 'path');\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n if (suffix !== undefined && suffix.length > 0 && suffix.length <= path.length) {\n if (suffix === path)\n return '';\n let extIdx = suffix.length - 1;\n let firstNonSlashEnd = -1;\n for (let i = path.length - 1; i >= 0; --i) {\n if (path[i] === '/') {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (path[i] === suffix[extIdx]) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n if (start === end)\n end = firstNonSlashEnd;\n else if (end === -1)\n end = path.length;\n return path.slice(start, end);\n }\n for (let i = path.length - 1; i >= 0; --i) {\n if (path[i] === '/') {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n }\n else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n if (end === -1)\n return '';\n return path.slice(start, end);\n}\nexport function extname(path) {\n validateString(path, 'path');\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n for (let i = path.length - 1; i >= 0; --i) {\n if (path[i] === '/') {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (path[i] === '.') {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (startDot === -1 ||\n end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {\n return '';\n }\n return path.slice(startDot, end);\n}\nexport function format(pathObject) {\n validateObject(pathObject, 'pathObject');\n const dir = pathObject.dir || pathObject.root;\n const base = pathObject.base || `${pathObject.name || ''}${formatExt(pathObject.ext)}`;\n if (!dir) {\n return base;\n }\n return dir === pathObject.root ? `${dir}${base}` : `${dir}/${base}`;\n}\nexport function parse(path) {\n validateString(path, 'path');\n const isAbsolute = path[0] === '/';\n const ret = { root: isAbsolute ? '/' : '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0)\n return ret;\n const start = isAbsolute ? 1 : 0;\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n // Get non-dir info\n for (; i >= start; --i) {\n if (path[i] === '/') {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (path[i] === '.') {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n }\n else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n if (end !== -1) {\n const start = startPart === 0 && isAbsolute ? 1 : startPart;\n if (startDot === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {\n ret.base = ret.name = path.slice(start, end);\n }\n else {\n ret.name = path.slice(start, startDot);\n ret.base = path.slice(start, end);\n ret.ext = path.slice(startDot, end);\n }\n }\n if (startPart > 0)\n ret.dir = path.slice(0, startPart - 1);\n else if (isAbsolute)\n ret.dir = '/';\n return ret;\n}\n", "import { basename, dirname, join } from '@browserfs/core/emulation/path.js';\nimport { ApiError, ErrorCode } from '@browserfs/core/ApiError.js';\nimport { Cred } from '@browserfs/core/cred.js';\nimport { FileFlag, PreloadFile } from '@browserfs/core/file.js';\nimport { BaseFileSystem, FileSystemMetadata } from '@browserfs/core/filesystem.js';\nimport { Stats, FileType } from '@browserfs/core/stats.js';\nimport { CreateBackend, type BackendOptions } from '@browserfs/core/backends/backend.js';\n\ndeclare global {\n\tinterface FileSystemDirectoryHandle {\n\t\t[Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>;\n\t\tentries(): AsyncIterableIterator<[string, FileSystemHandle]>;\n\t\tkeys(): AsyncIterableIterator<string>;\n\t\tvalues(): AsyncIterableIterator<FileSystemHandle>;\n\t}\n}\n\ninterface FileSystemAccessFileSystemOptions {\n\thandle: FileSystemDirectoryHandle;\n}\n\nconst handleError = (path: string = '', error: any) => {\n\tif (error instanceof ApiError) {\n\t\tthrow error;\n\t}\n\n\tif (error.name === 'NotFoundError') {\n\t\tthrow ApiError.ENOENT(path);\n\t}\n\tif (error.name === 'TypeError') {\n\t\tthrow ApiError.ENOENT(path);\n\t}\n\tif (error.name === 'NotAllowedError') {\n\t\tthrow ApiError.EACCES(path);\n\t}\n\n\tif (error?.message) {\n\t\tthrow new ApiError(ErrorCode.EIO, error.message, path);\n\t} else {\n\t\tthrow ApiError.FileError(ErrorCode.EIO, path);\n\t}\n};\n\nconst Array_fromAsync = async <T extends unknown>(asyncIterator: AsyncIterableIterator<T>) => {\n\tconst array: T[] = [];\n\tfor await (const value of asyncIterator) array.push(value);\n\treturn array;\n};\n\nexport class FileSystemAccessFile extends PreloadFile<FileSystemAccessFileSystem> {\n\tconstructor(_fs: FileSystemAccessFileSystem, _path: string, _flag: FileFlag, _stat: Stats, contents?: Uint8Array) {\n\t\tsuper(_fs, _path, _flag, _stat, contents);\n\t}\n\n\tpublic async sync(): Promise<void> {\n\t\tif (this.isDirty()) {\n\t\t\tawait this._fs._sync(this.getPath(), this.getBuffer(), this.getStats(), Cred.Root);\n\t\t\tthis.resetDirty();\n\t\t}\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tawait this.sync();\n\t}\n}\n\nexport class FileSystemAccessFileSystem extends BaseFileSystem {\n\tpublic static readonly Name = 'FileSystemAccess';\n\n\tpublic static Create = CreateBackend.bind(this);\n\n\tpublic static readonly Options: BackendOptions = {};\n\n\tpublic static isAvailable(): boolean {\n\t\treturn typeof FileSystemHandle === 'function';\n\t}\n\n\tprivate _handles: Map<string, FileSystemHandle> = new Map();\n\n\tpublic constructor({ handle }: FileSystemAccessFileSystemOptions) {\n\t\tsuper();\n\n\t\tthis._ready = (async (handle, ready) => {\n\t\t\thandle = await handle;\n\t\t\tif (!(handle instanceof FileSystemDirectoryHandle)) throw ApiError.ENOTDIR('/');\n\t\t\ttry {\n\t\t\t\tawait handle.keys().next();\n\t\t\t} catch (e) {\n\t\t\t\thandleError('/', e);\n\t\t\t}\n\t\t\tthis._handles.set('/', handle);\n\t\t\treturn ready;\n\t\t})(handle || navigator.storage.getDirectory(), this._ready);\n\t}\n\n\tpublic get metadata(): FileSystemMetadata {\n\t\treturn {\n\t\t\t...super.metadata,\n\t\t\tname: FileSystemAccessFileSystem.Name,\n\t\t};\n\t}\n\n\tpublic async _sync(p: string, data: Uint8Array, stats: Stats, cred: Cred): Promise<void> {\n\t\tconst currentStats = await this.stat(p, cred);\n\t\tif (stats.mtime !== currentStats!.mtime) {\n\t\t\tawait this.writeFile(p, data, FileFlag.getFileFlag('w'), currentStats!.mode, cred);\n\t\t}\n\t}\n\n\tpublic async rename(oldPath: string, newPath: string, cred: Cred): Promise<void> {\n\t\tlet path = oldPath;\n\t\ttry {\n\t\t\tconst handle = await this.getHandle(oldPath);\n\t\t\tconst parentHandle = await this.getHandle(dirname(oldPath), { parent: true });\n\t\t\tif (handle instanceof FileSystemDirectoryHandle) {\n\t\t\t\tconst files = await Array_fromAsync(handle.keys());\n\n\t\t\t\tawait this.getHandle(newPath, { create: 'directory' });\n\t\t\t\tfor (const file of files) {\n\t\t\t\t\t// recursive\n\t\t\t\t\tawait this.rename(join(oldPath, file), join(newPath, file), cred);\n\t\t\t\t}\n\t\t\t\tif (!parentHandle.isSameEntry(handle)) {\n\t\t\t\t\tawait parentHandle.removeEntry(handle.name);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (handle instanceof FileSystemFileHandle) {\n\t\t\t\tconst oldFile = await handle.getFile();\n\t\t\t\tconst buffer = await oldFile.arrayBuffer();\n\n\t\t\t\tpath = newPath;\n\t\t\t\tconst newFile = await this.getHandle(newPath, { create: 'file' });\n\t\t\t\tconst writable = await newFile.createWritable();\n\t\t\t\tawait writable.write(buffer);\n\n\t\t\t\t(path = newPath), writable.close();\n\t\t\t\t(path = oldPath), await parentHandle.removeEntry(handle.name);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\thandleError(path, e);\n\t\t}\n\t}\n\n\tpublic async writeFile(fname: string, data: Uint8Array, flag: FileFlag, mode: number, cred: Cred): Promise<void> {\n\t\ttry {\n\t\t\tconst file = await this.getHandle(fname, { create: 'file' });\n\t\t\tconst writable = await file.createWritable();\n\t\t\tawait writable.write(data);\n\t\t\tawait writable.close();\n\t\t} catch (e) {\n\t\t\thandleError(fname, e);\n\t\t}\n\t}\n\n\tpublic async createFile(p: string, flag: FileFlag, mode: number, cred: Cred): Promise<FileSystemAccessFile> {\n\t\tawait this.writeFile(p, new Uint8Array(), flag, mode, cred);\n\t\treturn this.openFile(p, flag, cred);\n\t}\n\n\tpublic async stat(path: string, cred: Cred): Promise<Stats> {\n\t\ttry {\n\t\t\tconst handle = await this.getHandle(path);\n\t\t\tif (handle instanceof FileSystemDirectoryHandle) {\n\t\t\t\treturn new Stats(FileType.DIRECTORY, 4096);\n\t\t\t}\n\t\t\tif (handle instanceof FileSystemFileHandle) {\n\t\t\t\tconst { lastModified, size } = await handle.getFile();\n\t\t\t\treturn new Stats(FileType.FILE, size, undefined, undefined, lastModified);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\thandleError(path, e);\n\t\t}\n\t\treturn undefined as never;\n\t}\n\n\tpublic async exists(p: string, cred: Cred): Promise<boolean> {\n\t\ttry {\n\t\t\tawait this.getHandle(p);\n\t\t\treturn true;\n\t\t} catch (e: any) {\n\t\t\tif (e?.errno !== ErrorCode.ENOENT) throw e;\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic async openFile(path: string, flags: FileFlag, cred: Cred): Promise<FileSystemAccessFile> {\n\t\ttry {\n\t\t\tconst handle = await this.getHandle(path);\n\t\t\tif (handle instanceof FileSystemFileHandle) {\n\t\t\t\tconst file = await handle.getFile();\n\t\t\t\tconst buffer = await file.arrayBuffer();\n\t\t\t\treturn this.newFile(path, flags, buffer, file.size, file.lastModified);\n\t\t\t} else {\n\t\t\t\tthrow ApiError.EISDIR(path);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\thandleError(path, e);\n\t\t}\n\t\treturn undefined as never;\n\t}\n\n\tpublic async unlink(path: string, cred: Cred): Promise<void> {\n\t\tif (path === '/') {\n\t\t\tconst files = await this.readdir(path, cred);\n\t\t\tfor (const file of files) {\n\t\t\t\tawait this.unlink('/' + file, cred);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tconst handle = await this.getHandle(path);\n\t\t\tconst parentHandle = await this.getHandle(dirname(path), { parent: true });\n\n\t\t\tawait parentHandle.removeEntry(basename(path), { recursive: true });\n\t\t} catch (e: any) {\n\t\t\tif (e?.errno === ErrorCode.ENOENT) return;\n\t\t\thandleError(path, e);\n\t\t}\n\t}\n\n\tpublic async rmdir(path: string, cred: Cred): Promise<void> {\n\t\treturn this.unlink(path, cred);\n\t}\n\n\tpublic async mkdir(p: string, mode: number, cred: Cred): Promise<void> {\n\t\ttry {\n\t\t\tawait this.getHandle(p);\n\t\t\tthrow ApiError.EEXIST(p);\n\t\t} catch (e: any) {\n\t\t\tif (e?.errno !== ErrorCode.ENOENT) throw e;\n\t\t}\n\n\t\tawait this.getHandle(p, { create: 'directory' });\n\t}\n\n\tpublic async readdir(path: string, cred: Cred): Promise<string[]> {\n\t\tconst handle = await this.getHandle(path);\n\t\tif (!(handle instanceof FileSystemDirectoryHandle)) {\n\t\t\tthrow ApiError.ENOTDIR(path);\n\t\t}\n\t\treturn await Array_fromAsync(handle.keys());\n\t}\n\n\tprivate newFile(path: string, flag: FileFlag, data: ArrayBuffer, size?: number, lastModified?: number): FileSystemAccessFile {\n\t\treturn new FileSystemAccessFile(this, path, flag, new Stats(FileType.FILE, size || 0, undefined, undefined, lastModified || new Date().getTime()), new Uint8Array(data));\n\t}\n\n\tprivate async getHandle(path: string): Promise<FileSystemHandle>;\n\tprivate async getHandle(path: string, opt: { create: 'file' }): Promise<FileSystemFileHandle>;\n\tprivate async getHandle(path: string, opt: { create: 'directory' }): Promise<FileSystemDirectoryHandle>;\n\tprivate async getHandle(path: string, opt: { parent: true }): Promise<FileSystemDirectoryHandle>;\n\n\tprivate async getHandle(path: string, { create, parent }: any = {}): Promise<FileSystemHandle> {\n\t\ttry {\n\t\t\tconst handle = this._handles.get(path);\n\t\t\tif (handle instanceof FileSystemFileHandle) await handle.getFile();\n\t\t\tif (handle instanceof FileSystemDirectoryHandle) parent || (await handle.keys().next());\n\t\t\tif (handle) return handle;\n\t\t} catch (e) {}\n\n\t\tvar walkPath = '';\n\t\ttry {\n\t\t\tvar walkPath = dirname(path);\n\t\t\tlet dirHandle = null;\n\t\t\ttry {\n\t\t\t\tconst handle = this._handles.get(walkPath);\n\t\t\t\tif (handle instanceof FileSystemDirectoryHandle) {\n\t\t\t\t\twalkPath === '/' || (await handle.keys().next());\n\t\t\t\t\tdirHandle = handle;\n\t\t\t\t}\n\t\t\t} catch (e: any) {\n\t\t\t\tif (e?.name === 'TypeMismatchError') throw ApiError.ENOTDIR(walkPath);\n\t\t\t}\n\t\t\tif (!dirHandle) {\n\t\t\t\tconst [, ...pathParts] = path.split('/');\n\n\t\t\t\twalkPath = '/';\n\t\t\t\tdirHandle = this._handles.get('/') as FileSystemDirectoryHandle;\n\n\t\t\t\tfor (const pathPart of pathParts) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\twalkPath = join(walkPath, pathPart);\n\t\t\t\t\t\tdirHandle = await dirHandle.getDirectoryHandle(pathPart);\n\t\t\t\t\t\tthis._handles.set(walkPath, dirHandle);\n\t\t\t\t\t} catch (error: any) {\n\t\t\t\t\t\tif (error?.name !== 'TypeMismatchError') throw error;\n\t\t\t\t\t\tthis._handles.set(walkPath, await dirHandle.getFileHandle(pathPart));\n\t\t\t\t\t\tthrow ApiError.ENOTDIR(walkPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst name = basename(path);\n\t\t\tvar walkPath = path;\n\t\t\tlet handle;\n\t\t\ttry {\n\t\t\t\thandle = await dirHandle.getDirectoryHandle(name, { create: create === 'directory' });\n\t\t\t} catch (e: any) {\n\t\t\t\tconst mismatch = e?.name === 'TypeMismatchError';\n\t\t\t\tconst createFile = create && e?.name === 'NotFoundError';\n\t\t\t\tif (!(mismatch || createFile)) throw e;\n\t\t\t\thandle = await dirHandle.getFileHandle(name, { create: create === 'file' });\n\t\t\t}\n\t\t\tthis._handles.set(walkPath, handle);\n\n\t\t\tconst expect = parent ? 'directory' : create;\n\t\t\tif (expect && expect !== handle.kind) {\n\t\t\t\tif (parent) throw ApiError.ENOTDIR(walkPath);\n\t\t\t\tif (handle.kind === 'directory') throw ApiError.EISDIR(walkPath);\n\t\t\t\t/* if (handle.kind === 'file') */ throw ApiError.EEXIST(walkPath);\n\t\t\t}\n\t\t\treturn handle;\n\t\t} catch (e) {\n\t\t\thandleError(walkPath, e);\n\t\t\treturn undefined as never;\n\t\t}\n\t}\n}\n", "import { decode, encode } from './utils.js';\n/**\n * Standard libc error codes. More will be added to this enum and ErrorStrings as they are\n * needed.\n * @url http://www.gnu.org/software/libc/manual/html_node/Error-Codes.html\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n ErrorCode[ErrorCode[\"EPERM\"] = 1] = \"EPERM\";\n ErrorCode[ErrorCode[\"ENOENT\"] = 2] = \"ENOENT\";\n ErrorCode[ErrorCode[\"EIO\"] = 5] = \"EIO\";\n ErrorCode[ErrorCode[\"EBADF\"] = 9] = \"EBADF\";\n ErrorCode[ErrorCode[\"EACCES\"] = 13] = \"EACCES\";\n ErrorCode[ErrorCode[\"EBUSY\"] = 16] = \"EBUSY\";\n ErrorCode[ErrorCode[\"EEXIST\"] = 17] = \"EEXIST\";\n ErrorCode[ErrorCode[\"ENOTDIR\"] = 20] = \"ENOTDIR\";\n ErrorCode[ErrorCode[\"EISDIR\"] = 21] = \"EISDIR\";\n ErrorCode[ErrorCode[\"EINVAL\"] = 22] = \"EINVAL\";\n ErrorCode[ErrorCode[\"EFBIG\"] = 27] = \"EFBIG\";\n ErrorCode[ErrorCode[\"ENOSPC\"] = 28] = \"ENOSPC\";\n ErrorCode[ErrorCode[\"EROFS\"] = 30] = \"EROFS\";\n ErrorCode[ErrorCode[\"ENOTEMPTY\"] = 39] = \"ENOTEMPTY\";\n ErrorCode[ErrorCode[\"ENOTSUP\"] = 95] = \"ENOTSUP\";\n})(ErrorCode = ErrorCode || (ErrorCode = {}));\n/**\n * Strings associated with each error code.\n * @internal\n */\nexport const ErrorStrings = {\n [ErrorCode.EPERM]: 'Operation not permitted.',\n [ErrorCode.ENOENT]: 'No such file or directory.',\n [ErrorCode.EIO]: 'Input/output error.',\n [ErrorCode.EBADF]: 'Bad file descriptor.',\n [ErrorCode.EACCES]: 'Permission denied.',\n [ErrorCode.EBUSY]: 'Resource busy or locked.',\n [ErrorCode.EEXIST]: 'File exists.',\n [ErrorCode.ENOTDIR]: 'File is not a directory.',\n [ErrorCode.EISDIR]: 'File is a directory.',\n [ErrorCode.EINVAL]: 'Invalid argument.',\n [ErrorCode.EFBIG]: 'File is too big.',\n [ErrorCode.ENOSPC]: 'No space left on disk.',\n [ErrorCode.EROFS]: 'Cannot modify a read-only file system.',\n [ErrorCode.ENOTEMPTY]: 'Directory is not empty.',\n [ErrorCode.ENOTSUP]: 'Operation is not supported.',\n};\n/**\n * Represents a BrowserFS error. Passed back to applications after a failed\n * call to the BrowserFS API.\n */\nexport class ApiError extends Error {\n static fromJSON(json) {\n const err = new ApiError(json.errno, json.message, json.path);\n err.code = json.code;\n err.stack = json.stack;\n return err;\n }\n /**\n * Creates an ApiError object from a buffer.\n */\n static Derserialize(data, i = 0) {\n const view = new DataView('buffer' in data ? data.buffer : data);\n const dataText = decode(view.buffer.slice(i + 4, i + 4 + view.getUint32(i, true)));\n return ApiError.fromJSON(JSON.parse(dataText));\n }\n static FileError(code, p) {\n return new ApiError(code, ErrorStrings[code], p);\n }\n static EACCES(path) {\n return this.FileError(ErrorCode.EACCES, path);\n }\n static ENOENT(path) {\n return this.FileError(ErrorCode.ENOENT, path);\n }\n static EEXIST(path) {\n return this.FileError(ErrorCode.EEXIST, path);\n }\n static EISDIR(path) {\n return this.FileError(ErrorCode.EISDIR, path);\n }\n static ENOTDIR(path) {\n return this.FileError(ErrorCode.ENOTDIR, path);\n }\n static EPERM(path) {\n return this.FileError(ErrorCode.EPERM, path);\n }\n static ENOTEMPTY(path) {\n return this.FileError(ErrorCode.ENOTEMPTY, path);\n }\n /**\n * Represents a BrowserFS error. Passed back to applications after a failed\n * call to the BrowserFS API.\n *\n * Error codes mirror those returned by regular Unix file operations, which is\n * what Node returns.\n * @constructor ApiError\n * @param type The type of the error.\n * @param [message] A descriptive error message.\n */\n constructor(type, message = ErrorStrings[type], path) {\n super(message);\n // Unsupported.\n this.syscall = '';\n this.errno = type;\n this.code = ErrorCode[type];\n this.path = path;\n this.message = `Error: ${this.code}: ${message}${this.path ? `, '${this.path}'` : ''}`;\n }\n /**\n * @return A friendly error message.\n */\n toString() {\n return this.message;\n }\n toJSON() {\n return {\n errno: this.errno,\n code: this.code,\n path: this.path,\n stack: this.stack,\n message: this.message,\n };\n }\n /**\n * Writes the API error into a buffer.\n */\n serialize(data = new Uint8Array(this.bufferSize()), i = 0) {\n const view = new DataView('buffer' in data ? data.buffer : data), buffer = new Uint8Array(view.buffer);\n const newData = encode(JSON.stringify(this.toJSON()));\n buffer.set(newData);\n view.setUint32(i, newData.byteLength, true);\n return buffer;\n }\n /**\n * The size of the API error in buffer-form in bytes.\n */\n bufferSize() {\n // 4 bytes for string length.\n return 4 + JSON.stringify(this.toJSON()).length;\n }\n}\n", "import { ErrorCode, ApiError } from './ApiError.js';\nimport * as path from './emulation/path.js';\n/**\n * Synchronous recursive makedir.\n * @internal\n */\nexport function mkdirpSync(p, mode, cred, fs) {\n if (!fs.existsSync(p, cred)) {\n mkdirpSync(path.dirname(p), mode, cred, fs);\n fs.mkdirSync(p, mode, cred);\n }\n}\n/*\n * Levenshtein distance, from the `js-levenshtein` NPM module.\n * Copied here to avoid complexity of adding another CommonJS module dependency.\n */\nfunction _min(d0, d1, d2, bx, ay) {\n return Math.min(d0 + 1, d1 + 1, d2 + 1, bx === ay ? d1 : d1 + 1);\n}\n/**\n * Calculates levenshtein distance.\n * @param a\n * @param b\n */\nfunction levenshtein(a, b) {\n if (a === b) {\n return 0;\n }\n if (a.length > b.length) {\n [a, b] = [b, a]; // Swap a and b\n }\n let la = a.length;\n let lb = b.length;\n // Trim common suffix\n while (la > 0 && a.charCodeAt(la - 1) === b.charCodeAt(lb - 1)) {\n la--;\n lb--;\n }\n let offset = 0;\n // Trim common prefix\n while (offset < la && a.charCodeAt(offset) === b.charCodeAt(offset)) {\n offset++;\n }\n la -= offset;\n lb -= offset;\n if (la === 0 || lb === 1) {\n return lb;\n }\n const vector = new Array(la << 1);\n for (let y = 0; y < la;) {\n vector[la + y] = a.charCodeAt(offset + y);\n vector[y] = ++y;\n }\n let x;\n let d0;\n let d1;\n let d2;\n let d3;\n for (x = 0; x + 3 < lb;) {\n const bx0 = b.charCodeAt(offset + (d0 = x));\n const bx1 = b.charCodeAt(offset + (d1 = x + 1));\n const bx2 = b.charCodeAt(offset + (d2 = x + 2));\n const bx3 = b.charCodeAt(offset + (d3 = x + 3));\n let dd = (x += 4);\n for (let y = 0; y < la;) {\n const ay = vector[la + y];\n const dy = vector[y];\n d0 = _min(dy, d0, d1, bx0, ay);\n d1 = _min(d0, d1, d2, bx1, ay);\n d2 = _min(d1, d2, d3, bx2, ay);\n dd = _min(d2, d3, dd, bx3, ay);\n vector[y++] = dd;\n d3 = d2;\n d2 = d1;\n d1 = d0;\n d0 = dy;\n }\n }\n let dd = 0;\n for (; x < lb;) {\n const bx0 = b.charCodeAt(offset + (d0 = x));\n dd = ++x;\n for (let y = 0; y < la; y++) {\n const dy = vector[y];\n vector[y] = dd = dy < d0 || dd < d0 ? (dy > dd ? dd + 1 : dy + 1) : bx0 === vector[la + y] ? d0 : d0 + 1;\n d0 = dy;\n }\n }\n return dd;\n}\n/**\n * Checks that the given options object is valid for the file system options.\n * @internal\n */\nexport async function checkOptions(backend, opts) {\n const optsInfo = backend.Options;\n const fsName = backend.Name;\n let pendingValidators = 0;\n let callbackCalled = false;\n let loopEnded = false;\n // Check for required options.\n for (const optName in optsInfo) {\n if (Object.prototype.hasOwnProperty.call(optsInfo, optName)) {\n const opt = optsInfo[optName];\n const providedValue = opts && opts[optName];\n if (providedValue === undefined || providedValue === null) {\n if (!opt.optional) {\n // Required option, not provided.\n // Any incorrect options provided? Which ones are close to the provided one?\n // (edit distance 5 === close)\n const incorrectOptions = Object.keys(opts)\n .filter(o => !(o in optsInfo))\n .map((a) => {\n return { str: a, distance: levenshtein(optName, a) };\n })\n .filter(o => o.distance < 5)\n .sort((a, b) => a.distance - b.distance);\n // Validators may be synchronous.\n if (callbackCalled) {\n return;\n }\n callbackCalled = true;\n throw new ApiError(ErrorCode.EINVAL, `[${fsName}] Required option '${optName}' not provided.${incorrectOptions.length > 0 ? ` You provided unrecognized option '${incorrectOptions[0].str}'; perhaps you meant to type '${optName}'.` : ''}\\nOption description: ${opt.description}`);\n }\n // Else: Optional option, not provided. That is OK.\n }\n else {\n // Option provided! Check type.\n let typeMatches = false;\n if (Array.isArray(opt.type)) {\n typeMatches = opt.type.indexOf(typeof providedValue) !== -1;\n }\n else {\n typeMatches = typeof providedValue === opt.type;\n }\n if (!typeMatches) {\n // Validators may be synchronous.\n if (callbackCalled) {\n return;\n }\n callbackCalled = true;\n throw new ApiError(ErrorCode.EINVAL, `[${fsName}] Value provided for option ${optName} is not the proper type. Expected ${Array.isArray(opt.type) ? `one of {${opt.type.join(', ')}}` : opt.type}, but received ${typeof providedValue}\\nOption description: ${opt.description}`);\n }\n else if (opt.validator) {\n pendingValidators++;\n try {\n await opt.validator(providedValue);\n }\n catch (e) {\n if (!callbackCalled) {\n if (e) {\n callbackCalled = true;\n throw e;\n }\n pendingValidators--;\n if (pendingValidators === 0 && loopEnded) {\n return;\n }\n }\n }\n }\n // Otherwise: All good!\n }\n }\n }\n loopEnded = true;\n if (pendingValidators === 0 && !callbackCalled) {\n return;\n }\n}\n/** Waits n ms. */\nexport function wait(ms) {\n return new Promise(resolve => {\n setTimeout(resolve, ms);\n });\n}\n/**\n * Converts a callback into a promise. Assumes last parameter is the callback\n * @todo Look at changing resolve value from cbArgs[0] to include other callback arguments?\n */\nexport function toPromise(fn) {\n return function (...args) {\n return new Promise((resolve, reject) => {\n args.push((e, ...cbArgs) => {\n if (e) {\n reject(e);\n }\n else {\n resolve(cbArgs[0]);\n }\n });\n fn(...args);\n });\n };\n}\n/**\n * @internal\n */\nexport const setImmediate = typeof globalThis.setImmediate == 'function' ? globalThis.setImmediate : cb => setTimeout(cb, 0);\n/**\n * @internal\n */\nexport const ROOT_NODE_ID = '/';\n// prettier-ignore\nexport function encode(string, encoding = 'utf8') {\n let input = string || '';\n switch (encoding) {\n default:\n case 'utf8':\n case 'utf-8':\n return new TextEncoder().encode(input);\n case 'utf16le':\n case 'utf-16le':\n case 'ucs2':\n case 'ucs-2':\n return new Uint8Array(Uint16Array.from(input.split(''), (c) => c.charCodeAt(0)).buffer);\n case 'ascii':\n case 'latin1':\n case 'binary':\n return Uint8Array.from(input.split(''), (c) => c.charCodeAt(0));\n case 'hex':\n return Uint8Array.from(input.match(/../g), (s) => parseInt(s, 16));\n case 'base64':\n case 'base64url':\n input = input.replaceAll('-', '+').replaceAll('_', '/');\n return Uint8Array.from(atob(input).split(''), (c) => c.charCodeAt(0));\n }\n}\n// prettier-ignore\nexport function decode(data, encoding = 'utf8') {\n if (!data || !data.byteLength)\n return '';\n const input = new Uint8Array('buffer' in data ? data.buffer : data);\n switch (encoding) {\n default:\n case 'utf8':\n case 'utf-8':\n return new TextDecoder('utf-8').decode(input);\n case 'utf16le':\n case 'utf-16le':\n case 'ucs2':\n case 'ucs-2':\n return new TextDecoder('utf-16le').decode(input);\n case 'ascii':\n return new TextDecoder('utf-8').decode(input.map(i => i & 127));\n case 'latin1':\n case 'binary':\n return new TextDecoder('utf-16').decode(new Uint8Array(Uint16Array.from(input).buffer));\n case 'hex':\n return Array.from(input, i => i.toString(16).padStart(2, '0')).join('');\n case 'base64':\n return btoa(new TextDecoder('utf-16').decode(new Uint8Array(Uint16Array.from(input).buffer)));\n case 'base64url':\n return btoa(new TextDecoder('utf-16').decode(new Uint8Array(Uint16Array.from(input).buffer))).replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', '');\n }\n}\n/**\n * Generates a random ID.\n * @internal\n */\nexport function randomUUID() {\n // From http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n", "import { checkOptions } from '../utils.js';\nexport function CreateBackend(options, cb) {\n cb = typeof options === 'function' ? options : cb;\n checkOptions(this, options);\n const fs = new this(typeof options === 'function' ? {} : options);\n // Promise\n if (typeof cb != 'function') {\n return fs.whenReady();\n }\n // Callback\n fs.whenReady()\n .then(fs => cb(null, fs))\n .catch(err => cb(err));\n}\n", "import { BaseFileSystem, FileSystemMetadata } from '@browserfs/core/filesystem.js';\nimport { ApiError, ErrorCode } from '@browserfs/core/ApiError.js';\nimport { FileFlag, ActionType, NoSyncFile } from '@browserfs/core/file.js';\nimport { Stats } from '@browserfs/core/stats.js';\nimport { fetchIsAvailable, fetchFile, fetchFileSize } from '../fetch.js';\nimport { FileIndex, isIndexFileInode, isIndexDirInode } from '@browserfs/core/FileIndex.js';\nimport { Cred } from '@browserfs/core/cred.js';\nimport { CreateBackend, type BackendOptions } from '@browserfs/core/backends/backend.js';\nimport { R_OK } from '@browserfs/core/emulation/constants.js';\n\nexport interface HTTPRequestIndex {\n\t[key: string]: string;\n}\n\nexport namespace HTTPRequest {\n\t/**\n\t * Configuration options for a HTTPRequest file system.\n\t */\n\texport interface Options {\n\t\t/**\n\t\t * URL to a file index as a JSON file or the file index object itself, generated with the make_http_index script.\n\t\t * Defaults to `index.json`.\n\t\t */\n\t\tindex?: string | HTTPRequestIndex;\n\n\t\t/** Used as the URL prefix for fetched files.\n\t\t * Default: Fetch files relative to the index.\n\t\t */\n\t\tbaseUrl?: string;\n\t}\n}\n\n/**\n * A simple filesystem backed by HTTP downloads. You must create a directory listing using the\n * `make_http_index` tool provided by BrowserFS.\n *\n * If you install BrowserFS globally with `npm i -g browserfs`, you can generate a listing by\n * running `make_http_index` in your terminal in the directory you would like to index:\n *\n * ```\n * make_http_index > index.json\n * ```\n *\n * Listings objects look like the following:\n *\n * ```json\n * {\n * \"home\": {\n * \"jvilk\": {\n * \"someFile.txt\": null,\n * \"someDir\": {\n * // Empty directory\n * }\n * }\n * }\n * }\n * ```\n *\n * *This example has the folder `/home/jvilk` with subfile `someFile.txt` and subfolder `someDir`.*\n */\nexport class HTTPRequest extends BaseFileSystem {\n\tpublic static readonly Name = 'HTTPRequest';\n\n\tpublic static Create = CreateBackend.bind(this);\n\n\tpublic static readonly Options: BackendOptions = {\n\t\tindex: {\n\t\t\ttype: ['string', 'object'],\n\t\t\toptional: true,\n\t\t\tdescription: 'URL to a file index as a JSON file or the file index object itself, generated with the make_http_index script. Defaults to `index.json`.',\n\t\t},\n\t\tbaseUrl: {\n\t\t\ttype: 'string',\n\t\t\toptional: true,\n\t\t\tdescription: 'Used as the URL prefix for fetched files. Default: Fetch files relative to the index.',\n\t\t},\n\t};\n\n\tpublic static isAvailable(): boolean {\n\t\treturn fetchIsAvailable;\n\t}\n\n\tpublic readonly prefixUrl: string;\n\tprivate _index: FileIndex<{}>;\n\n\tconstructor({ index, baseUrl = '' }: HTTPRequest.Options) {\n\t\tsuper();\n\t\tif (!index) {\n\t\t\tindex = 'index.json';\n\t\t}\n\n\t\tconst indexRequest = typeof index == 'string' ? fetchFile(index, 'json') : Promise.resolve(index);\n\t\tthis._ready = indexRequest.then(data => {\n\t\t\tthis._index = FileIndex.fromListing(data);\n\t\t\treturn this;\n\t\t});\n\n\t\t// prefix_url must end in a directory separator.\n\t\tif (baseUrl.length > 0 && baseUrl.charAt(baseUrl.length - 1) !== '/') {\n\t\t\tbaseUrl = baseUrl + '/';\n\t\t}\n\t\tthis.prefixUrl = baseUrl;\n\t}\n\n\tpublic get metadata(): FileSystemMetadata {\n\t\treturn {\n\t\t\t...super.metadata,\n\t\t\tname: HTTPRequest.Name,\n\t\t\treadonly: true,\n\t\t};\n\t}\n\n\tpublic empty(): void {\n\t\tthis._index.fileIterator(function (file: Stats) {\n\t\t\tfile.fileData = null;\n\t\t});\n\t}\n\n\t/**\n\t * Special HTTPFS function: Preload the given file into the index.\n\t * @param path\n\t * @param buffer\n\t */\n\tpublic preloadFile(path: string, buffer: Uint8Array): void {\n\t\tconst inode = this._index.getInode(path);\n\t\tif (isIndexFileInode<Stats>(inode)) {\n\t\t\tif (inode === null) {\n\t\t\t\tthrow ApiError.ENOENT(path);\n\t\t\t}\n\t\t\tconst stats = inode.getData();\n\t\t\tstats.size = buffer.length;\n\t\t\tstats.fileData = buffer;\n\t\t} else {\n\t\t\tthrow ApiError.EISDIR(path);\n\t\t}\n\t}\n\n\tpublic async stat(path: string, cred: Cred): Promise<Stats> {\n\t\tconst inode = this._index.getInode(path);\n\t\tif (inode === null) {\n\t\t\tthrow ApiError.ENOENT(path);\n\t\t}\n\t\tif (!inode.toStats().hasAccess(R_OK, cred)) {\n\t\t\tthrow ApiError.EACCES(path);\n\t\t}\n\t\tlet stats: Stats;\n\t\tif (isIndexFileInode<Stats>(inode)) {\n\t\t\tstats = inode.getData();\n\t\t\t// At this point, a non-opened file will still have default stats from the listing.\n\t\t\tif (stats.size < 0) {\n\t\t\t\tstats.size = await this._requestFileSize(path);\n\t\t\t}\n\t\t} else if (isIndexDirInode(inode)) {\n\t\t\tstats = inode.getStats();\n\t\t} else {\n\t\t\tthrow ApiError.FileError(ErrorCode.EINVAL, path);\n\t\t}\n\t\treturn stats;\n\t}\n\n\tpublic async open(path: string, flags: FileFlag, mode: number, cred: Cred): Promise<NoSyncFile<this>> {\n\t\t// INVARIANT: You can't write to files on this file system.\n\t\tif (flags.isWriteable()) {\n\t\t\tthrow new ApiError(ErrorCode.EPERM, path);\n\t\t}\n\t\t// Check if the path exists, and is a file.\n\t\tconst inode = this._index.getInode(path);\n\t\tif (inode === null) {\n\t\t\tthrow ApiError.ENOENT(path);\n\t\t}\n\t\tif (!inode.toStats().hasAccess(flags.getMode(), cred)) {\n\t\t\tthrow ApiError.EACCES(path);\n\t\t}\n\t\tif (isIndexFileInode<Stats>(inode) || isIndexDirInode<Stats>(inode)) {\n\t\t\tswitch (flags.pathExistsAction()) {\n\t\t\t\tcase ActionType.THROW_EXCEPTION:\n\t\t\t\tcase ActionType.TRUNCATE_FILE:\n\t\t\t\t\tthrow ApiError.EEXIST(path);\n\t\t\t\tcase ActionType.NOP:\n\t\t\t\t\tif (isIndexDirInode<Stats>(inode)) {\n\t\t\t\t\t\tconst stats = inode.getStats();\n\t\t\t\t\t\treturn new NoSyncFile(this, path, flags, stats, stats.fileData || undefined);\n\t\t\t\t\t}\n\t\t\t\t\tconst stats = inode.getData();\n\t\t\t\t\t// Use existing file contents.\n\t\t\t\t\t// XXX: Uh, this maintains the previously-used flag.\n\t\t\t\t\tif (stats.fileData) {\n\t\t\t\t\t\treturn new NoSyncFile(this, path, flags, Stats.clone(stats), stats.fileData);\n\t\t\t\t\t}\n\t\t\t\t\t// @todo be lazier about actually requesting the file\n\t\t\t\t\tconst buffer = await this._requestFile(path, 'buffer');\n\t\t\t\t\t// we don't initially have file sizes\n\t\t\t\t\tstats.size = buffer.length;\n\t\t\t\t\tstats.fileData = buffer;\n\t\t\t\t\treturn new NoSyncFile(this, path, flags, Stats.clone(stats), buffer);\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new ApiError(ErrorCode.EINVAL, 'Invalid FileMode object.');\n\t\t\t}\n\t\t} else {\n\t\t\tthrow ApiError.EPERM(path);\n\t\t}\n\t}\n\n\tpublic async readdir(path: string, cred: Cred): Promise<string[]> {\n\t\treturn this.readdirSync(path, cred);\n\t}\n\n\t/**\n\t * We have the entire file as a buffer; optimize readFile.\n\t */\n\tpublic async readFile(fname: string, flag: FileFlag, cred: Cred): Promise<Uint8Array> {\n\t\t// Get file.\n\t\tconst fd: NoSyncFile<HTTPRequest> = await this.open(fname, flag, 0o644, cred);\n\t\ttry {\n\t\t\treturn fd.getBuffer();\n\t\t} finally {\n\t\t\tawait fd.close();\n\t\t}\n\t}\n\n\tprivate _getHTTPPath(filePath: string): string {\n\t\tif (filePath.charAt(0) === '/') {\n\t\t\tfilePath = filePath.slice(1);\n\t\t}\n\t\treturn this.prefixUrl + filePath;\n\t}\n\n\t/**\n\t * Asynchronously download the given file.\n\t */\n\tprivate _requestFile(p: string, type: 'buffer'): Promise<Uint8Array>;\n\tprivate _requestFile(p: string, type: 'json'): Promise<any>;\n\tprivate _requestFile(p: string, type: 'buffer' | 'json'): Promise<any>;\n\tprivate _requestFile(p: string, type: 'buffer' | 'json'): Promise<any> {\n\t\treturn fetchFile(this._getHTTPPath(p), type);\n\t}\n\n\t/**\n\t * Only requests the HEAD content, for the file size.\n\t */\n\tprivate _requestFileSize(path: string): Promise<number> {\n\t\treturn fetchFileSize(this._getHTTPPath(path));\n\t}\n}\n", "/**\n * Contains utility methods for network I/O (using fetch)\n */\nimport { ApiError, ErrorCode } from '@browserfs/core/ApiError.js';\n\nexport const fetchIsAvailable = typeof fetch !== 'undefined' && fetch !== null;\n\n/**\n * @hidden\n */\nfunction convertError(e): never {\n\tthrow new ApiError(ErrorCode.EIO, e.message);\n}\n\n/**\n * Asynchronously download a file as a buffer or a JSON object.\n * Note that the third function signature with a non-specialized type is\n * invalid, but TypeScript requires it when you specialize string arguments to\n * constants.\n * @hidden\n */\nexport async function fetchFile(p: string, type: 'buffer'): Promise<Uint8Array>;\nexport async function fetchFile(p: string, type: 'json'): Promise<any>;\nexport async function fetchFile(p: string, type: 'buffer' | 'json'): Promise<any>;\nexport async function fetchFile(p: string, type: 'buffer' | 'json'): Promise<any> {\n\tconst response = await fetch(p).catch(convertError);\n\tif (!response.ok) {\n\t\tthrow new ApiError(ErrorCode.EIO, `fetch error: response returned code ${response.status}`);\n\t}\n\tswitch (type) {\n\t\tcase 'buffer':\n\t\t\tconst arrayBuffer = await response.arrayBuffer().catch(convertError);\n\t\t\treturn new Uint8Array(arrayBuffer);\n\t\tcase 'json':\n\t\t\treturn response.json().catch(convertError);\n\t\tdefault:\n\t\t\tthrow new ApiError(ErrorCode.EINVAL, 'Invalid download type: ' + type);\n\t}\n}\n\n/**\n * Asynchronously retrieves the size of the given file in bytes.\n * @hidden\n */\nexport async function fetchFileSize(p: string): Promise<number> {\n\tconst response = await fetch(p, { method: 'HEAD' }).catch(convertError);\n\tif (!response.ok) {\n\t\tthrow new ApiError(ErrorCode.EIO, `fetch HEAD error: response returned code ${response.status}`);\n\t}\n\treturn parseInt(response.headers.get('Content-Length') || '-1', 10);\n}\n", "import { AsyncKeyValueROTransaction, AsyncKeyValueRWTransaction, AsyncKeyValueStore, AsyncKeyValueFileSystem } from '@browserfs/core/backends/AsyncStore.js';\nimport { ApiError, ErrorCode } from '@browserfs/core/ApiError.js';\nimport { CreateBackend, type BackendOptions } from '@browserfs/core/backends/backend.js';\n\n/**\n * Converts a DOMException or a DOMError from an IndexedDB event into a\n * standardized BrowserFS API error.\n * @hidden\n */\nfunction convertError(e: { name: string }, message: string = e.toString()): ApiError {\n\tswitch (e.name) {\n\t\tcase 'NotFoundError':\n\t\t\treturn new ApiError(ErrorCode.ENOENT, message);\n\t\tcase 'QuotaExceededError':\n\t\t\treturn new ApiError(ErrorCode.ENOSPC, message);\n\t\tdefault:\n\t\t\t// The rest do not seem to map cleanly to standard error codes.\n\t\t\treturn new ApiError(ErrorCode.EIO, message);\n\t}\n}\n\n/**\n * Produces a new onerror handler for IDB. Our errors are always fatal, so we\n * handle them generically: Call the user-supplied callback with a translated\n * version of the error, and let the error bubble up.\n * @hidden\n */\nfunction onErrorHandler(cb: (e: ApiError) => void, code: ErrorCode = ErrorCode.EIO, message: string | null = null): (e?: any) => void {\n\treturn function (e?: any): void {\n\t\t// Prevent the error from canceling the transaction.\n\t\te.preventDefault();\n\t\tcb(new ApiError(code, message !== null ? message : undefined));\n\t};\n}\n\n/**\n * @hidden\n */\nexport class IndexedDBROTransaction implements AsyncKeyValueROTransaction {\n\tconstructor(public tx: IDBTransaction, public store: IDBObjectStore) {}\n\n\tpublic get(key: string): Promise<Uint8Array> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tconst r: IDBRequest = this.store.get(key);\n\t\t\t\tr.onerror = onErrorHandler(reject);\n\t\t\t\tr.onsuccess = event => {\n\t\t\t\t\t// IDB returns the value 'undefined' when you try to get keys that\n\t\t\t\t\t// don't exist. The caller expects this behavior.\n\t\t\t\t\tconst result = (<any>event.target).result;\n\t\t\t\t\tif (result === undefined) {\n\t\t\t\t\t\tresolve(result);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// IDB data is stored as an ArrayUint8Array\n\t\t\t\t\t\tresolve(Uint8Array.from(result));\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\treject(convertError(e));\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @hidden\n */\nexport class IndexedDBRWTransaction extends IndexedDBROTransaction implements AsyncKeyValueRWTransaction, AsyncKeyValueROTransaction {\n\tconstructor(tx: IDBTransaction, store: IDBObjectStore) {\n\t\tsuper(tx, store);\n\t}\n\n\t/**\n\t * @todo return false when add has a key conflict (no error)\n\t */\n\tpublic put(key: string, data: Uint8Array, overwrite: boolean): Promise<boolean> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tconst r: IDBRequest = overwrite ? this.store.put(data, key) : this.store.add(data, key);\n\t\t\t\tr.onerror = onErrorHandler(reject);\n\t\t\t\tr.onsuccess = () => {\n\t\t\t\t\tresolve(true);\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\treject(convertError(e));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic del(key: string): Promise<void> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tconst r: IDBRequest = this.store.delete(key);\n\t\t\t\tr.onerror = onErrorHandler(reject);\n\t\t\t\tr.onsuccess = () => {\n\t\t\t\t\tresolve();\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\treject(convertError(e));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic commit(): Promise<void> {\n\t\treturn new Promise(resolve => {\n\t\t\t// Return to the event loop to commit the transaction.\n\t\t\tsetTimeout(resolve, 0);\n\t\t});\n\t}\n\n\tpublic abort(): Promise<void> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tthis.tx.abort();\n\t\t\t\tresolve();\n\t\t\t} catch (e) {\n\t\t\t\treject(convertError(e));\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport class IndexedDBStore implements AsyncKeyValueStore {\n\tpublic static Create(storeName: string, indexedDB: IDBFactory): Promise<IndexedDBStore> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst openReq: IDBOpenDBRequest = indexedDB.open(storeName, 1);\n\n\t\t\topenReq.onupgradeneeded = event => {\n\t\t\t\tconst db: IDBDatabase = (<IDBOpenDBRequest>event.target).result;\n\t\t\t\t// Huh. This should never happen; we're at version 1. Why does another\n\t\t\t\t// database exist?\n\t\t\t\tif (db.objectStoreNames.contains(storeName)) {\n\t\t\t\t\tdb.deleteObjectStore(storeName);\n\t\t\t\t}\n\t\t\t\tdb.createObjectStore(storeName);\n\t\t\t};\n\n\t\t\topenReq.onsuccess = event => {\n\t\t\t\tresolve(new IndexedDBStore((<IDBOpenDBRequest>event.target).result, storeName));\n\t\t\t};\n\n\t\t\topenReq.onerror = onErrorHandler(reject, ErrorCode.EACCES);\n\t\t});\n\t}\n\n\tconstructor(private db: IDBDatabase, private storeName: string) {}\n\n\tpublic name(): string {\n\t\treturn IndexedDBFileSystem.Name + ' - ' + this.storeName;\n\t}\n\n\tpublic clear(): Promise<void> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tconst tx = this.db.transaction(this.storeName, 'readwrite'),\n\t\t\t\t\tobjectStore = tx.objectStore(this.storeName),\n\t\t\t\t\tr: IDBRequest = objectStore.clear();\n\t\t\t\tr.onsuccess = () => {\n\t\t\t\t\t// Use setTimeout to commit transaction.\n\t\t\t\t\tsetTimeout(resolve, 0);\n\t\t\t\t};\n\t\t\t\tr.onerror = onErrorHandler(reject);\n\t\t\t} catch (e) {\n\t\t\t\treject(convertError(e));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic beginTransaction(type: 'readonly'): AsyncKeyValueROTransaction;\n\tpublic beginTransaction(type: 'readwrite'): AsyncKeyValueRWTransaction;\n\tpublic beginTransaction(type: 'readonly' | 'readwrite' = 'readonly'): AsyncKeyValueROTransaction {\n\t\tconst tx = this.db.transaction(this.storeName, type),\n\t\t\tobjectStore = tx.objectStore(this.storeName);\n\t\tif (type === 'readwrite') {\n\t\t\treturn new IndexedDBRWTransaction(tx, objectStore);\n\t\t} else if (type === 'readonly') {\n\t\t\treturn new IndexedDBROTransaction(tx, objectStore);\n\t\t} else {\n\t\t\tthrow new ApiError(ErrorCode.EINVAL, 'Invalid transaction type.');\n\t\t}\n\t}\n}\n\nexport namespace IndexedDBFileSystem {\n\t/**\n\t * Configuration options for the IndexedDB file system.\n\t */\n\texport interface Options {\n\t\t/**\n\t\t * The name of this file system. You can have multiple IndexedDB file systems operating at once, but each must have a different name.\n\t\t */\n\t\tstoreName?: string;\n\n\t\t/**\n\t\t * The size of the inode cache. Defaults to 100. A size of 0 or below disables caching.\n\t\t */\n\t\tcacheSize?: number;\n\n\t\t/**\n\t\t * The IDBFactory to use. Defaults to `globalThis.indexedDB`.\n\t\t */\n\t\tidbFactory?: IDBFactory;\n\t}\n}\n\n/**\n * A file system that uses the IndexedDB key value file system.\n */\nexport class IndexedDBFileSystem extends AsyncKeyValueFileSystem {\n\tpublic static readonly Name = 'IndexedDB';\n\n\tpublic static Create = CreateBackend.bind(this);\n\n\tpublic static readonly Options: BackendOptions = {\n\t\tstoreName: {\n\t\t\ttype: 'string',\n\t\t\toptional: true,\n\t\t\tdescription: 'The name of this file system. You can have multiple IndexedDB file systems operating at once, but each must have a different name.',\n\t\t},\n\t\tcacheSize: {\n\t\t\ttype: 'number',\n\t\t\toptional: true,\n\t\t\tdescription: 'The size of the inode cache. Defaults to 100. A size of 0 or below disables caching.',\n\t\t},\n\t\tidbFactory: {\n\t\t\ttype: 'object',\n\t\t\toptional: true,\n\t\t\tdescription: 'The IDBFactory to use. Defaults to globalThis.indexedDB.',\n\t\t},\n\t};\n\n\tpublic static isAvailable(idbFactory: IDBFactory = globalThis.indexedDB): boolean {\n\t\ttry {\n\t\t\tif (!(idbFactory instanceof IDBFactory)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst req = idbFactory.open('__browserfs_test__');\n\t\t\tif (!req) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tconstructor({ cacheSize = 100, storeName = 'browserfs', idbFactory = globalThis.indexedDB }: IndexedDBFileSystem.Options) {\n\t\tsuper(cacheSize);\n\t\tthis._ready = IndexedDBStore.Create(storeName, idbFactory).then(store => {\n\t\t\tthis.init(store);\n\t\t\treturn this;\n\t\t});\n\t}\n}\n", "import { SyncKeyValueStore, SimpleSyncStore, SyncKeyValueFileSystem, SimpleSyncRWTransaction, SyncKeyValueRWTransaction } from '@browserfs/core/backends/SyncStore.js';\nimport { ApiError, ErrorCode } from '@browserfs/core/ApiError.js';\nimport { CreateBackend, type BackendOptions } from '@browserfs/core/backends/backend.js';\nimport { utf16Encode, utf16Decode } from '../utf16coder.js';\n\n/**\n * A synchronous key-value store backed by Storage.\n */\nexport class StorageStore implements SyncKeyValueStore, SimpleSyncStore {\n\tpublic name(): string {\n\t\treturn StorageFileSystem.Name;\n\t}\n\n\tconstructor(protected _storage: Storage) {}\n\n\tpublic clear(): void {\n\t\tthis._storage.clear();\n\t}\n\n\tpublic beginTransaction(type: string): SyncKeyValueRWTransaction {\n\t\t// No need to differentiate.\n\t\treturn new SimpleSyncRWTransaction(this);\n\t}\n\n\tpublic get(key: string): Uint8Array | undefined {\n\t\tconst data = this._storage.getItem(key);\n\t\tif (typeof data != 'string') {\n\t\t\treturn;\n\t\t}\n\n\t\treturn utf16Decode(data);\n\t}\n\n\tpublic put(key: string, data: Uint8Array, overwrite: boolean): boolean {\n\t\ttry {\n\t\t\tif (!overwrite && this._storage.getItem(key) !== null) {\n\t\t\t\t// Don't want to overwrite the key!\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tthis._storage.setItem(key, utf16Encode(data));\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t\tthrow new ApiError(ErrorCode.ENOSPC, 'Storage is full.');\n\t\t}\n\t}\n\n\tpublic del(key: string): void {\n\t\ttry {\n\t\t\tthis._storage.removeItem(key);\n\t\t} catch (e) {\n\t\t\tthrow new ApiError(ErrorCode.EIO, 'Unable to delete key ' + key + ': ' + e);\n\t\t}\n\t}\n}\n\nexport namespace StorageFileSystem {\n\t/**\n\t * Options to pass to the StorageFileSystem\n\t */\n\texport interface Options {\n\t\t/**\n\t\t * The Storage to use. Defaults to globalThis.localStorage.\n\t\t */\n\t\tstorage: Storage;\n\t}\n}\n\n/**\n * A synchronous file system backed by a `Storage` (e.g. localStorage).\n */\nexport class StorageFileSystem extends SyncKeyValueFileSystem {\n\tpublic static readonly Name = 'Storage';\n\n\tpublic static Create = CreateBackend.bind(this);\n\n\tpublic static readonly Options: BackendOptions = {\n\t\tstorage: {\n\t\t\ttype: 'object',\n\t\t\toptional: true,\n\t\t\tdescription: 'The Storage to use. Defaults to globalThis.localStorage.',\n\t\t},\n\t};\n\n\tpublic static isAvailable(storage: Storage = globalThis.localStorage): boolean {\n\t\treturn storage instanceof Storage;\n\t}\n\t/**\n\t * Creates a new Storage file system using the contents of `Storage`.\n\t */\n\tconstructor({ storage = globalThis.localStorage }: StorageFileSystem.Options) {\n\t\tsuper({ store: new StorageStore(storage) });\n\t}\n}\n", "/**\n * Contains utility methods for encode/decode binary to string\n */\n\n/* Convertion between Uint16 and char */\nconst itoc = x => String.fromCodePoint(x >> 11 !== 27 ? x : x | 0x10000);\nconst ctoi = x => x.codePointAt(0); // Uint16Array will trunc extra high bit\n\n/* Tool to encode [Uint8, Uint7] to a char */\nconst iitoc =\n\tnew Int16Array(Int8Array.from([-1, 0]).buffer)[0] < 0\n\t\t? (a, b) => String.fromCodePoint((a << 8) | b) // BigEndian\n\t\t: (a, b) => String.fromCharCode(a | (b << 8)); // LittleEndian\n\n/**\n * Encode binary to string\n * @param data8 any binary data\n * @returns an UTF16 string with extra data\n */\nexport function utf16Encode(data8: Uint8Array): string {\n\tlet { length, buffer, byteOffset, byteLength } = data8;\n\tconst pfx = byteOffset % 2; // extra start byte to shift\n\tconst sfx = byteLength % 2; // either odd and padding end bytes\n\tlet head;\n\n\tif (pfx) {\n\t\tdata8 = new Uint8Array(buffer, --byteOffset, byteLength + 1);\n\t\t// backup head and shift, to align to 16 bits word\n\t\thead = data8[0];\n\t\tdata8.copyWithin(0, 1);\n\t}\n\n\tconst data16 = new Uint16Array(buffer, byteOffset, byteLength >> 1);\n\tconst lastByte = sfx && data8[length - 1]; // odd end byte, else padding byte\n\tconst extraByte = 2 - sfx; // padding bytes counts\n\n\tconst dataChars = Array.from(data16, itoc);\n\tdataChars.push(iitoc(lastByte, extraByte));\n\n\tif (pfx) {\n\t\t// unshift and restore, to revert changes made to buffer\n\t\tdata8.copyWithin(1, 0);\n\t\tdata8[0] = head;\n\t}\n\n\treturn dataChars.join('');\n}\n\n/**\n * Decode binary from sting\n * @param string an UTF16 string with extra data\n * @returns copy of the original binary data\n */\nexport function utf16Decode(string: string): Uint8Array {\n\tconst data16 = Uint16Array.from(string, ctoi);\n\tconst data8 = new Uint8Array(data16.buffer);\n\n\tconst { length, buffer } = data8;\n\tconst sfx = data8[length - 1]; // extra bytes count\n\n\t// return new Uint8Array(buffer, 0, length - sfx); // performance\n\treturn new Uint8Array(buffer.slice(0, length - sfx)); // compatibility\n}\n", "import { type FileSystem, BaseFileSystem, FileContents, FileSystemMetadata } from '@browserfs/core/filesystem.js';\nimport { ApiError, ErrorCode } from '@browserfs/core/ApiError.js';\nimport { File, FileFlag } from '@browserfs/core/file.js';\nimport { Stats } from '@browserfs/core/stats.js';\nimport { Cred } from '@browserfs/core/cred.js';\nimport { CreateBackend, type BackendOptions } from '@browserfs/core/backends/backend.js';\n\n/**\n * @hidden\n */\ndeclare const importScripts: (...path: string[]) => unknown;\n\n/**\n * An RPC message\n */\ninterface RPCMessage {\n\tisBFS: true;\n\tid: number;\n}\n\ntype _FSAsyncMethods = {\n\t[Method in keyof FileSystem]: Extract<FileSystem[Method], (...args: unknown[]) => Promise<unknown>>;\n};\n\ntype _RPCFSRequests = {\n\t[Method in keyof _FSAsyncMethods]: { method: Method; args: Parameters<_FSAsyncMethods[Method]> };\n};\n\ntype _RPCFSResponses = {\n\t[Method in keyof _FSAsyncMethods]: { method: Method; value: Awaited<ReturnType<_FSAsyncMethods[Method]>> };\n};\n\n/**\n * @see https://stackoverflow.com/a/60920767/17637456\n */\ntype RPCRequest = RPCMessage & (_RPCFSRequests[keyof _FSAsyncMethods] | { method: 'metadata'; args: [] } | { method: 'syncClose'; args: [string, File] });\n\ntype RPCResponse = RPCMessage & (_RPCFSResponses[keyof _FSAsyncMethods] | { method: 'metadata'; value: FileSystemMetadata } | { method: 'syncClose'; value: null });\n\nfunction isRPCMessage(arg: unknown): arg is RPCMessage {\n\treturn typeof arg == 'object' && 'isBFS' in arg && !!arg.isBFS;\n}\n\ntype _executor = Parameters<ConstructorParameters<typeof Promise>[0]>;\ninterface WorkerRequest {\n\tresolve: _executor[0];\n\treject: _executor[1];\n}\n\nexport namespace WorkerFS {\n\texport interface Options {\n\t\t/**\n\t\t * The target worker that you want to connect to, or the current worker if in a worker context.\n\t\t */\n\t\tworker: Worker;\n\t}\n}\n\ntype _RPCExtractReturnValue<T extends RPCResponse['method']> = Promise<Extract<RPCResponse, { method: T }>['value']>;\n\n/**\n * WorkerFS lets you access a BrowserFS instance that is running in a different\n * JavaScript context (e.g. access BrowserFS in one of your WebWorkers, or\n * access BrowserFS running on the main page from a WebWorker).\n *\n * For example, to have a WebWorker access files in the main browser thread,\n * do the following:\n *\n * MAIN BROWSER THREAD:\n *\n * ```javascript\n * // Listen for remote file system requests.\n * BrowserFS.Backend.WorkerFS.attachRemoteListener(webWorkerObject);\n * ```\n *\n * WEBWORKER THREAD:\n *\n * ```javascript\n * // Set the remote file system as the root file system.\n * BrowserFS.configure({ fs: \"WorkerFS\", options: { worker: self }}, function(e) {\n * // Ready!\n * });\n * ```\n *\n * Note that synchronous operations are not permitted on the WorkerFS, regardless\n * of the configuration option of the remote FS.\n */\nexport class WorkerFS extends BaseFileSystem {\n\tpublic static readonly Name = 'WorkerFS';\n\n\tpublic static Create = CreateBackend.bind(this);\n\n\tpublic static readonly Options: BackendOptions = {\n\t\tworker: {\n\t\t\ttype: 'object',\n\t\t\tdescription: 'The target worker that you want to connect to, or the current worker if in a worker context.',\n\t\t\tvalidator(worker: Worker) {\n\t\t\t\t// Check for a `postMessage` function.\n\t\t\t\tif (typeof worker?.postMessage != 'function') {\n\t\t\t\t\tthrow new ApiError(ErrorCode.EINVAL, 'option must be a Web Worker instance.');\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t};\n\n\tpublic static isAvailable(): boolean {\n\t\treturn typeof importScripts !== 'undefined' || typeof Worker !== 'undefined';\n\t}\n\n\tprivate _worker: Worker;\n\tprivate _currentID: number = 0;\n\tprivate _requests: Map<number, WorkerRequest> = new Map();\n\n\tprivate _isInitialized: boolean = false;\n\tprivate _metadata: FileSystemMetadata;\n\n\t/**\n\t * Constructs a new WorkerFS instance that connects with BrowserFS running on\n\t * the specified worker.\n\t */\n\tpublic constructor({ worker }: WorkerFS.Options) {\n\t\tsuper();\n\t\tthis._worker = worker;\n\t\tthis._worker.onmessage = (event: MessageEvent) => {\n\t\t\tif (!isRPCMessage(event.data)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { id, method, value } = event.data as RPCResponse;\n\n\t\t\tif (method === 'metadata') {\n\t\t\t\tthis._metadata = value;\n\t\t\t\tthis._isInitialized = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { resolve, reject } = this._requests.get(id);\n\t\t\tthis._requests.delete(id);\n\t\t\tif (value instanceof Error || value instanceof ApiError) {\n\t\t\t\treject(value);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(value);\n\t\t};\n\t}\n\n\tpublic get metadata(): FileSystemMetadata {\n\t\treturn {\n\t\t\t...super.metadata,\n\t\t\t...this._metadata,\n\t\t\tname: WorkerFS.Name,\n\t\t\tsynchronous: false,\n\t\t};\n\t}\n\n\tprivate async _rpc<T extends RPCRequest['method']>(method: T, ...args: Extract<RPCRequest, { method: T }>['args']): _RPCExtractReturnValue<T> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst id = this._currentID++;\n\t\t\tthis._requests.set(id, { resolve, reject });\n\t\t\tthis._worker.postMessage({\n\t\t\t\tisBFS: true,\n\t\t\t\tid,\n\t\t\t\tmethod,\n\t\t\t\targs,\n\t\t\t} as RPCRequest);\n\t\t});\n\t}\n\n\tpublic rename(oldPath: string, newPath: string, cred: Cred): Promise<void> {\n\t\treturn this._rpc('rename', oldPath, newPath, cred);\n\t}\n\tpublic stat(p: string, cred: Cred): Promise<Stats> {\n\t\treturn this._rpc('stat', p, cred);\n\t}\n\tpublic open(p: string, flag: FileFlag, mode: number, cred: Cred): Promise<File> {\n\t\treturn this._rpc('open', p, flag, mode, cred);\n\t}\n\tpublic unlink(p: string, cred: Cred): Promise<void> {\n\t\treturn this._rpc('unlink', p, cred);\n\t}\n\tpublic rmdir(p: string, cred: Cred): Promise<void> {\n\t\treturn this._rpc('rmdir', p, cred);\n\t}\n\tpublic mkdir(p: string, mode: number, cred: Cred): Promise<void> {\n\t\treturn this._rpc('mkdir', p, mode, cred);\n\t}\n\tpublic readdir(p: string, cred: Cred): Promise<string[]> {\n\t\treturn this._rpc('readdir', p, cred);\n\t}\n\tpublic exists(p: string, cred: Cred): Promise<boolean> {\n\t\treturn this._rpc('exists', p, cred);\n\t}\n\tpublic realpath(p: string, cred: Cred): Promise<string> {\n\t\treturn this._rpc('realpath', p, cred);\n\t}\n\tpublic truncate(p: string, len: number, cred: Cred): Promise<void> {\n\t\treturn this._rpc('truncate', p, len, cred);\n\t}\n\tpublic readFile(fname: string, flag: FileFlag, cred: Cred): Promise<Uint8Array> {\n\t\treturn this._rpc('readFile', fname, flag, cred);\n\t}\n\tpublic writeFile(fname: string, data: Uint8Array, flag: FileFlag, mode: number, cred: Cred): Promise<void> {\n\t\treturn this._rpc('writeFile', fname, data, flag, mode, cred);\n\t}\n\tpublic appendFile(fname: string, data: Uint8Array, flag: FileFlag, mode: number, cred: Cred): Promise<void> {\n\t\treturn this._rpc('appendFile', fname, data, flag, mode, cred);\n\t}\n\tpublic chmod(p: string, mode: number, cred: Cred): Promise<void> {\n\t\treturn this._rpc('chmod', p, mode, cred);\n\t}\n\tpublic chown(p: string, new_uid: number, new_gid: number, cred: Cred): Promise<void> {\n\t\treturn this._rpc('chown', p, new_uid, new_gid, cred);\n\t}\n\tpublic utimes(p: string, atime: Date, mtime: Date, cred: Cred): Promise<void> {\n\t\treturn this._rpc('utimes', p, atime, mtime, cred);\n\t}\n\tpublic link(srcpath: string, dstpath: string, cred: Cred): Promise<void> {\n\t\treturn this._rpc('link', srcpath, dstpath, cred);\n\t}\n\tpublic symlink(srcpath: string, dstpath: string, type: string, cred: Cred): Promise<void> {\n\t\treturn this._rpc('symlink', srcpath, dstpath, type, cred);\n\t}\n\tpublic readlink(p: string, cred: Cred): Promise<string> {\n\t\treturn this._rpc('readlink', p, cred);\n\t}\n\n\tpublic syncClose(method: string, fd: File): Promise<void> {\n\t\treturn this._rpc('syncClose', method, fd);\n\t}\n}\n"],
"mappings": "isBAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,QAAU,YCAjB,IAAAC,GAAAC,EAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,QAAU,YCAjB,IAAAC,GAAAC,EAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,QAAU,YCAjB,IAAAC,EAAAC,EAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,QAAU,YCAjB,IAAAC,GAAAC,EAAA,CAAAC,GAAAC,KAAA,CAAAA,GAAO,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I,OAAOA,GAAQ,aAAe,WACjC,MAAM,IAAI,WAAS,YAAU,OAAQ,uCAAuC,CAE9E,CACD,CACD",
"names": ["require_ApiError", "__commonJSMin", "exports", "module", "require_cred", "__commonJSMin", "exports", "module", "require_file", "__commonJSMin", "exports", "module", "require_filesystem", "__commonJSMin", "exports", "module", "require_stats", "__commonJSMin", "exports", "module", "require_FileIndex", "__commonJSMin", "exports", "module", "require_AsyncStore", "__commonJSMin", "exports", "module", "require_SyncStore", "__commonJSMin", "exports", "module", "src_exports", "__export", "FileSystemAccessFile", "FileSystemAccessFileSystem", "HTTPRequest", "IndexedDBFileSystem", "IndexedDBROTransaction", "IndexedDBRWTransaction", "IndexedDBStore", "StorageFileSystem", "StorageStore", "WorkerFS", "validateString", "str", "name", "__name", "normalizeString", "path", "allowAboveRoot", "res", "lastSegmentLength", "lastSlash", "dots", "char", "i", "lastSlashIndex", "__name", "normalize", "path", "validateString", "isAbsolute", "trailingSeparator", "normalizeString", "__name", "join", "args", "joined", "i", "arg", "validateString", "normalize", "__name", "dirname", "path", "validateString", "hasRoot", "end", "matchedSlash", "i", "__name", "basename", "suffix", "start", "extIdx", "firstNonSlashEnd", "import_ApiError", "import_cred", "import_file", "import_filesystem", "import_stats", "ErrorCode", "ErrorStrings", "ApiError", "json", "err", "data", "i", "view", "dataText", "decode", "code", "p", "path", "type", "message", "buffer", "newData", "encode", "__name", "_min", "d0", "d1", "d2", "bx", "ay", "__name", "levenshtein", "a", "b", "la", "lb", "offset", "vector", "x", "d3", "bx0", "bx1", "bx2", "bx3", "dd", "y", "dy", "checkOptions", "backend", "opts", "optsInfo", "fsName", "pendingValidators", "callbackCalled", "loopEnded", "optName", "opt", "providedValue", "incorrectOptions", "o", "ApiError", "ErrorCode", "typeMatches", "e", "setImmediate", "cb", "encode", "string", "encoding", "input", "c", "s", "__name", "decode", "data", "i", "CreateBackend", "options", "cb", "checkOptions", "fs", "err", "__name", "handleError", "__name", "path", "error", "Array_fromAsync", "asyncIterator", "array", "value", "FileSystemAccessFile", "_fs", "_path", "_flag", "_stat", "contents", "_FileSystemAccessFileSystem", "handle", "ready", "e", "p", "data", "stats", "cred", "currentStats", "oldPath", "newPath", "parentHandle", "dirname", "files", "file", "join", "buffer", "writable", "fname", "flag", "mode", "lastModified", "size", "flags", "basename", "create", "parent", "walkPath", "dirHandle", "pathParts", "pathPart", "name", "mismatch", "createFile", "expect", "FileSystemAccessFileSystem", "CreateBackend", "import_filesystem", "import_ApiError", "import_file", "import_stats", "import_ApiError", "fetchIsAvailable", "convertError", "e", "__name", "fetchFile", "p", "type", "response", "arrayBuffer", "fetchFileSize", "import_FileIndex", "_HTTPRequest", "index", "baseUrl", "indexRequest", "fetchFile", "data", "fetchIsAvailable", "file", "path", "buffer", "inode", "stats", "cred", "flags", "mode", "fname", "flag", "fd", "filePath", "p", "type", "fetchFileSize", "HTTPRequest", "__name", "CreateBackend", "import_AsyncStore", "import_ApiError", "convertError", "e", "message", "__name", "onErrorHandler", "cb", "code", "IndexedDBROTransaction", "tx", "store", "key", "resolve", "reject", "r", "event", "result", "IndexedDBRWTransaction", "data", "overwrite", "IndexedDBStore", "db", "storeName", "indexedDB", "openReq", "IndexedDBFileSystem", "objectStore", "type", "_IndexedDBFileSystem", "idbFactory", "cacheSize", "CreateBackend", "import_SyncStore", "import_ApiError", "itoc", "__name", "x", "ctoi", "iitoc", "a", "b", "utf16Encode", "data8", "length", "buffer", "byteOffset", "byteLength", "pfx", "sfx", "head", "data16", "lastByte", "extraByte", "dataChars", "utf16Decode", "string", "StorageStore", "_storage", "StorageFileSystem", "type", "key", "data", "utf16Decode", "overwrite", "utf16Encode", "__name", "_StorageFileSystem", "storage", "CreateBackend", "import_filesystem", "import_ApiError", "isRPCMessage", "arg", "__name", "_WorkerFS", "worker", "event", "id", "method", "value", "resolve", "reject", "args", "oldPath", "newPath", "cred", "p", "flag", "mode", "len", "fname", "data", "new_uid", "new_gid", "atime", "mtime", "srcpath", "dstpath", "type", "fd", "WorkerFS", "CreateBackend"]
}