import BareTree from './bare/tree'; import { File, Tree, Links, SyncHook, FileSystemOptions, HeaderTree, PinMap } from './types'; import { CID, FileContent } from '../ipfs'; declare type AppPath = { public: (appUuid: string, suffix?: string | Array) => string; private: (appUuid: string, suffix?: string | Array) => string; }; declare type ConstructorParams = { root: Tree; publicTree: HeaderTree; prettyTree: BareTree; privateTree: HeaderTree; pinsTree: BareTree; rootDid: string; }; export declare class FileSystem { root: Tree; publicTree: HeaderTree; prettyTree: BareTree; privateTree: HeaderTree; pinsTree: BareTree; rootDid: string; appPath: AppPath; syncHooks: Array; syncWhenOnline: CID | null; constructor({ root, publicTree, prettyTree, privateTree, pinsTree, rootDid }: ConstructorParams); /** * Creates a file system with an empty public tree & an empty private tree at the root. */ static empty(opts?: FileSystemOptions): Promise; /** * Loads an existing file system from a CID. */ static fromCID(cid: CID, opts?: FileSystemOptions): Promise; /** * Deactivate a file system. * * Use this when a user signs out. * The only function of this is to stop listing to online/offline events. */ deactivate(): void; add(path: string, content: FileContent): Promise; cat(path: string): Promise; exists(path: string): Promise; get(path: string): Promise; ls(path: string): Promise; mkdir(path: string): Promise; mv(from: string, to: string): Promise; read(path: string): Promise; rm(path: string): Promise; write(path: string, content: FileContent): Promise; /** * Retrieves all pins needed for private filesystem and adds them to the 'pin tree' */ updatePinTree(pins: PinMap): Promise; /** * Ensures the latest version of the file system is added to IPFS and returns the root CID. */ sync(): Promise; /** @internal */ addChild(path: string, toAdd: Tree | FileContent): Promise; /** @internal */ runOnTree(path: string, updateTree: boolean, // ie. do a mutation fn: (tree: Tree, relPath: string) => Promise): Promise; /** @internal */ whenOnline(): void; } export default FileSystem;