tav-media
Version:
Cross platform media editing framework
43 lines (42 loc) • 1.54 kB
TypeScript
/// <reference types="emscripten" />
export declare let fs: typeof FS;
export declare function setFS(fsModule: typeof FS): void;
/**
* Utils to work with file system.
*/
export declare class FileSystem {
/**
* Download file from url to WASM virtual file system.
* @param localPath The local path to write the data to.
* @param fetchInput The url or Request object to fetch.
* @param fetchInit The RequestInit object to modify the request.
* @returns true if success, false if failed.
*/
static download(localPath: string, fetchInput: RequestInfo, fetchInit?: RequestInit): Promise<boolean>;
/**
* Write text or binary data to WASM virtual file system.
* @param localPath The local path to write the data to.
* @param data The text or binary data to write.
*/
static writeFile(localPath: string, data: string | ArrayBufferView, opts?: {
flags?: string | undefined;
}): void;
/**
* Read text or binary data from WASM virtual file system.
* @param localPath The local path to read the data from.
* @returns File content as text or binary data.
*/
static readFile(localPath: string): Uint8Array;
/**
* Get parent directory of a path.
* @param path Any path.
* @returns The parent directory of the path.
*/
static getParentDir(path: string): string;
/**
* Make directory in WASM virtual file system.
* @param path Directory path.
* @returns void
*/
static mkdir(path: string): void;
}