UNPKG

@pgxsinkit/pgwasm

Version:
55 lines • 2.63 kB
import { BaseFilesystem } from "../fs/base-filesystem"; import type { FilesystemDescription, FsStats } from "../fs/base-filesystem"; import type { RepackedPort } from "./core/port"; import { RepackedVfs } from "./core/repacked-vfs"; /** Physical durability selected once for the lifetime of a store `createOpfsPgwasm` opens. */ export type RepackedDurability = "relaxed" | "strict"; export interface RepackedFilesystemOptions { /** Creation extent size: 8 KiB–16 MiB in 8 KiB steps. Defaults to 64 KiB. */ readonly extentSize?: number; /** Physical durability for this instance. Defaults to `"relaxed"`. */ readonly durability?: RepackedDurability; } /** * The pgwasm filesystem adapter owned by `createOpfsPgwasm`. * * Direct construction is unsupported. The factory retains this adapter so it * can close all four handles when host initialization or shutdown fails. */ export declare abstract class OpfsRepackedFS extends BaseFilesystem { #private; protected constructor(vfs: RepackedVfs, durability: RepackedDurability); /** An OPFS-repacked store: its data directory outlives the page. */ get description(): FilesystemDescription; initialSyncFs(): Promise<void>; syncToFs(relaxedDurability?: boolean): Promise<void>; /** Stabilize every preceding data and metadata operation in strict order. */ strictSync(): void; /** @internal Factory lifecycle cleanup after host initialization fails. */ cleanupFailedInit(): Promise<void>; closeFs(): Promise<void>; chmod(path: string, mode: number): void; close(fd: number): void; fstat(fd: number): FsStats; lstat(path: string): FsStats; mkdir(path: string, options?: { recursive?: boolean; mode?: number; }): void; open(path: string, flags?: string, mode?: number): number; readdir(path: string): string[]; read(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): number; rename(oldPath: string, newPath: string): void; rmdir(path: string): void; truncate(path: string, length: number): void; unlink(path: string): void; utimes(path: string, atime: number, mtime: number): void; writeFile(path: string, data: string | Uint8Array, options?: { encoding?: string; mode?: number; flag?: string; }): void; write(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): number; } export declare function openOpfsRepackedFsForPort(port: RepackedPort, options?: RepackedFilesystemOptions): Promise<OpfsRepackedFS>; //# sourceMappingURL=opfs-repacked-fs.d.ts.map