@fairdatasociety/fairdrive-opfs
Version:
Fairdrive OPFS - integrate data sources from Web 2.0 or Web 3.0
54 lines (53 loc) • 1.72 kB
TypeScript
import { Mount, Entries, FdpConnectProvider } from '../core/provider';
import { ProviderDriver } from '../core/provider-driver';
import { IPFSHTTPClient } from 'ipfs-http-client';
/**
* IpfsMfsProviderDriver is the driver for the IPFS MFS provider.
*/
export declare class IpfsMfsProviderDriver implements ProviderDriver {
host: any;
client: IPFSHTTPClient;
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>;
/**
* Creates a directory
* @param name - directory name
* @param mount - mount to check
* @returns Returns true if the directory created, else false
*/
createDir(name: string, mount: Mount): Promise<boolean>;
delete(filePath: string, mount: Mount): Promise<boolean>;
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, options?: {}): 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?: {}): Promise<any>;
}
/**
* IPFSMfsProvider is the provider for IPFS MFS.
*/
export declare class IPFSMfsProvider extends FdpConnectProvider {
private host;
constructor(host?: string);
initialize(options: any): void;
listMounts(): Promise<Mount[]>;
}