opfs-tools
Version:
EN: A simple, high-performance, and comprehensive file system API running in the browser, built on [OPFS](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system).
26 lines (25 loc) • 942 B
TypeScript
export interface FileSystemSyncAccessHandle {
read: (container: ArrayBuffer, opts: {
at: number;
}) => Promise<number>;
write: (data: ArrayBuffer | ArrayBufferView, opts?: {
at: number;
}) => Promise<number>;
flush: () => Promise<void>;
close: () => Promise<void>;
truncate: (newSize: number) => Promise<void>;
getSize: () => Promise<number>;
}
export declare function parsePath(path: string): {
parent: null;
name: string;
} | {
name: string;
parent: string;
};
export declare function getFSHandle<ISFile extends boolean, ISCreate extends boolean, T = ISFile extends true ? FileSystemFileHandle : FileSystemDirectoryHandle, RT = ISCreate extends true ? T : T | null>(path: string, opts: {
create?: ISCreate;
isFile?: ISFile;
}): Promise<RT>;
export declare function remove(path: string): Promise<void>;
export declare function joinPath(p1: string, p2: string): string;