/// import FetchResult from '../common/models/FetchResult'; /** * Class that implements the IPFS Storage functionality. */ export default class IpfsStorage { /** IPFS node instance */ private node; /** IPFS Storage class object */ static ipfsStorageInstance: IpfsStorage; /** * Static method to have a single instance of class and mock in unit tests */ static create(repo?: any): IpfsStorage; private constructor(); /** * Reads the stored content of the content identifier. * @param hash Content identifier to fetch the content. * @param maxSizeInBytes The maximum allowed size limit of the content. * @returns The fetch result containg the content buffer if found. * The result `code` is set to `FetchResultCode.NotFound` if the content is not found. * The result `code` is set to `FetchResultCode.MaxSizeExceeded` if the content exceeds the specified max size. * The result `code` is set to `FetchResultCode.NotAFile` if the content being downloaded is not a file (e.g. a directory). */ read(hash: string, maxSizeInBytes: number): Promise; /** * Fetch the content from IPFS. * This method also allows easy mocking in tests. */ private fetchContent; /** * Writes the passed content to the IPFS storage. * @param content Sidetree content to write to IPFS storage. * @returns The multihash content identifier of the stored content. */ write(content: Buffer): Promise; /** * Stops this IPFS store. */ stop(): void; }