@uprtcl/ipfs-provider
Version:
_Prtcl provider wrappers around ipfs-http-client
32 lines (31 loc) • 1.1 kB
TypeScript
import { CidConfig, CASStore, Connection, ConnectionOptions } from '@uprtcl/multiplatform';
import { Logger } from '@uprtcl/micro-orchestrator';
import { IpfsConnectionOptions } from './types';
import { PinnerCached } from './pinner';
export interface PutConfig {
format: string;
hashAlg: string;
cidVersion: number;
pin?: boolean;
}
export declare class IpfsStore extends Connection implements CASStore {
cidConfig: CidConfig;
protected client?: any;
protected pinner?: PinnerCached | undefined;
logger: Logger;
casID: string;
constructor(cidConfig?: CidConfig, client?: any, pinner?: PinnerCached | undefined, connectionOptions?: ConnectionOptions);
/**
* @override
*/
connect(ipfsOptions?: IpfsConnectionOptions): Promise<void>;
/**
* Adds a raw js object to IPFS with the given cid configuration
*/
create(object: object): Promise<string>;
private putIpfs;
/**
* Retrieves the object with the given hash from IPFS
*/
get(hash: string): Promise<object | undefined>;
}