UNPKG

filecoin-pin

Version:

Bridge IPFS content to Filecoin Onchain Cloud using familiar tools

46 lines 1.41 kB
/** * Browser-compatible CAR Blockstore * Writes blocks to an in-memory CAR structure instead of a file */ import type { CID } from 'multiformats/cid'; import { CARBlockstoreBase, type CARBlockstoreStats } from './car-blockstore-base.js'; export type { CARBlockstoreStats }; export interface CARBlockstoreOptions { rootCID: CID; } /** * A blockstore that writes blocks to an in-memory CAR structure * This eliminates the need for redundant storage during IPFS operations in the browser * * @example * ```ts * import { CARWritingBlockstore } from './browser-car-blockstore.js' * import { CID } from 'multiformats/cid' * * // Create with a placeholder or actual root CID * const blockstore = new CARWritingBlockstore({ * rootCID: someCID, * }) * * await blockstore.initialize() * * // Add blocks (same as Node.js version) * await blockstore.put(cid, blockData) * * // Finalize when done * await blockstore.finalize() * * // Get the complete CAR file * const carBytes = blockstore.getCarBytes() // Uint8Array ready for upload * ``` */ export declare class CARWritingBlockstore extends CARBlockstoreBase { private readonly memoryBackend; constructor(options: CARBlockstoreOptions); /** * Get the complete CAR file as Uint8Array * Can only be called after finalize() */ getCarBytes(): Uint8Array; } //# sourceMappingURL=browser-car-blockstore.d.ts.map