@metatime/pinning-service
Version:
Pinning service that is built on Google Cloud Storage on top of IPFS.
36 lines (35 loc) • 1.23 kB
TypeScript
import BucketHelper from "./bucket-helper";
import { Options, CID } from "ipfs-http-client";
export interface IPin {
pinAsset(bucketName: string, filePath: string, data: string): Promise<{
cid: CID;
fileUri: string;
} | null>;
}
/**
* A class that pins asset to GCP storage and IPFS client
* @class Pin
* @implements {IPin} - Pin class interface
* @property {IPFSHTTPClient} client - Ipfs client options
*/
declare class Pin extends BucketHelper implements IPin {
/** @private */
private client;
/**
* @param {string} _credentials - Google Cloud Storage credentials
* @param {object} _clientOptions - IPFS client options
*/
constructor(_baseUri: string, _credentials: any, _clientOptions?: Options);
/**
* Pins asset to GCP storage on top of IPFS
* @param {string} bucketName - Google Cloud Storage bucket name
* @param {string} filePath - Path in the Google Cloud Storage bucket
* @param {string} data - Object or buffer data of file
* @returns {any} Result of pinned asset
*/
pinAsset(bucketName: string, filePath: string, data: any): Promise<{
cid: CID;
fileUri: string;
} | null>;
}
export default Pin;