filecoin-pin
Version:
Bridge IPFS content to Filecoin Onchain Cloud using familiar tools
41 lines • 1.55 kB
TypeScript
/**
* Browser-compatible UnixFS to CAR conversion functionality
*
* This module provides utilities to create CAR files from browser Files
* using @helia/unixfs and BrowserCARBlockstore.
*/
import { CID } from 'multiformats/cid';
export interface CreateCarOptions {
bare?: boolean;
onProgress?: (bytesProcessed: number, totalBytes: number) => void;
}
export interface CreateCarResult {
carBytes: Uint8Array;
rootCid: CID;
}
/**
* Create a CAR file from a File using UnixFS encoding
*
* @param file - Browser File object to encode
* @param options - Optional bare flag and progress callback
* @returns CAR bytes and root CID
*/
export declare function createCarFromFile(file: File, options?: CreateCarOptions): Promise<CreateCarResult>;
/**
* Create a CAR file from multiple Files using UnixFS encoding
*
* @param files - Array of browser File objects to encode
* @param options - Optional progress callback
* @returns CAR bytes and root CID
*/
export declare function createCarFromFiles(files: File[], options?: CreateCarOptions): Promise<CreateCarResult>;
/**
* Create a CAR file from Files with directory structure preserved
* Handles webkitRelativePath for directory uploads
*
* @param files - Array of browser File objects with potential webkitRelativePath
* @param options - Optional progress callback
* @returns CAR bytes and root CID
*/
export declare function createCarFromFileList(files: File[], options?: CreateCarOptions): Promise<CreateCarResult>;
//# sourceMappingURL=browser-car-builder.d.ts.map