Static
forCreates an IPFS storage instance configured for Infura
Infura project credentials
Your Infura project ID
Your Infura project secret
Configured IpfsStorage instance for Infura
Static
forCreates an IPFS storage instance configured for a local IPFS node
Optional
options: { url?: string }Local node configuration options
Optional
url?: stringBase URL of the local IPFS node (defaults to http://localhost:5001)
Configured IpfsStorage instance for local node
Uploads a file to IPFS and returns the content identifier (CID)
The file to upload to IPFS
Optional
filename: stringOptional filename (for metadata purposes only)
Promise that resolves to StorageUploadResult with IPFS gateway URL
Downloads a file from IPFS using its content identifier (CID)
The IPFS content identifier, ipfs:// URL, or gateway URL
Promise that resolves to the downloaded file content
This method retrieves the file from IPFS using the configured gateway. It accepts various formats including raw CIDs, ipfs:// URLs, and gateway URLs. The file is downloaded from the globally distributed IPFS network.
// Download using raw CID
const file = await ipfsStorage.download("QmTzQ1JRkWErjk39mryYw2WVrgBMe2B36gRq8GCL8qCACj");
// Download using ipfs:// URL
const file2 = await ipfsStorage.download("ipfs://QmTzQ1JRkWErjk39mryYw2WVrgBMe2B36gRq8GCL8qCACj");
// Create download link
const url = URL.createObjectURL(file);
List files from the storage provider
Optional
_options: StorageListOptionsPromise with file list
Delete a file from the storage provider
Promise with success status
Get provider-specific configuration
Provider configuration object
Connects to any standard IPFS node or service provider
Remarks
This provider implements the standard IPFS HTTP API (
/api/v0/add
) and works with any IPFS-compatible service. It provides the essential IPFS operations (upload/download) while maintaining the immutable, content-addressed nature of IPFS. Use static factory methods for common providers like Infura or local nodes.Example