@fairdatasociety/fairdrive-opfs
Version:
Fairdrive OPFS - integrate data sources from Web 2.0 or Web 3.0
60 lines (59 loc) • 1.83 kB
TypeScript
import { Mount, Entries, FdpConnectProvider } from '../core/provider';
import { ProviderDriver } from '../core/provider-driver';
import * as Minio from 'minio';
/**
* S3ProviderDriver is the driver for AWS S3 provider.
*/
export declare class S3ProviderDriver implements ProviderDriver {
client: Minio.Client;
region: string;
constructor(options: {
port: number;
endpoint: string;
region: string;
useSSL: boolean;
accessKeyId: string;
secretAccessKey: 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>;
}
/**
* S3Provider is the provider for AWS S3.
*/
export declare class S3Provider extends FdpConnectProvider {
private host;
client: Minio.Client;
constructor(host?: string);
initialize(options: any): void;
listMounts(): Promise<Mount[]>;
}