UNPKG

@fairdatasociety/fairdrive-opfs

Version:

Fairdrive OPFS - integrate data sources from Web 2.0 or Web 3.0

68 lines (67 loc) 2.05 kB
import { Mount, Entries, FdpConnectProvider } from '../core/provider'; import { ProviderDriver } from '../core/provider-driver'; /** * FairosProviderDriver is the driver for the FairOS provider. */ export declare class FairosProviderDriver implements ProviderDriver { host: any; constructor(options: { host: string; }); /** * Verify if a file exists * @param path - path to the file * @param mount - mount to check * @returns Returns true if the file exists, else false */ exists(path: string, mount: Mount): Promise<boolean>; createDir(name: string, mount: Mount): Promise<any>; delete(filePath: string, mount: Mount): Promise<any>; read(mount: Mount): Promise<Entries>; /** * Download a file * @param id - id of the file * @param mount - mount to download the file from * @param options - options * @returns */ download(id: string, mount: Mount): Promise<any>; /** * Upload a file * @param file - file to upload * @param mount - mount to upload to * @param options - options */ upload(file: File, mount: Mount, options?: { overwrite: boolean; path: string; }): Promise<any>; } /** * FairosProvider is the provider for the FairOS provider. */ export declare class FairosProvider extends FdpConnectProvider { private host; constructor(host?: string); /** * Initialize the provider * @param options options */ initialize(options: any): void; /** * Login a user * @param user - username * @param pass - password * @returns Returns a promise with the response */ userLogin(user: string, pass: string): Promise<any>; /** * Verify if a user is logged in * @param username - username * @returns Returns a promise with the response */ userLoggedIn(username: string): Promise<any>; listMounts(): Promise<Mount[]>; podOpen(mount: Mount): Promise<void>; podClose(mount: Mount): Promise<void>; }