Vana SDK - v0.1.0
    Preparing search index...

    Interface StorageProvider

    Interface for storage providers that handle file upload, download, and management operations.

    Storage providers abstract different storage backends (IPFS, Google Drive, Pinata, etc.) behind a common interface. The SDK uses these providers to store encrypted user data and permission grants in a decentralized manner.

    // Implement a custom storage provider
    class MyStorageProvider implements StorageProvider {
    async upload(file: Blob, filename?: string): Promise<StorageUploadResult> {
    // Custom upload logic
    return { url: 'https://my-storage.com/file.dat', size: file.size };
    }

    async download(url: string): Promise<Blob> {
    // Custom download logic
    const response = await fetch(url);
    return response.blob();
    }

    async list(options?: StorageListOptions): Promise<StorageFile[]> {
    // Return list of files
    return [];
    }

    async delete(url: string): Promise<void> {
    // Delete file implementation
    }
    }
    interface StorageProvider {
        upload(file: Blob, filename?: string): Promise<StorageUploadResult>;
        download(url: string): Promise<Blob>;
        list(options?: StorageListOptions): Promise<StorageFile[]>;
        delete(url: string): Promise<boolean>;
        getConfig(): StorageProviderConfig;
    }

    Implemented by

    Index

    Methods

    • Upload a file to the storage provider

      Parameters

      • file: Blob

        The file to upload

      • Optionalfilename: string

        Optional custom filename

      Returns Promise<StorageUploadResult>

      Promise with storage URL and metadata

    • Download a file from the storage provider

      Parameters

      • url: string

        The storage URL

      Returns Promise<Blob>

      Promise with file blob

    • List files from the storage provider

      Parameters

      • Optionaloptions: StorageListOptions

        Optional filtering and pagination

      Returns Promise<StorageFile[]>

      Promise with file list

    • Delete a file from the storage provider

      Parameters

      • url: string

        The storage URL

      Returns Promise<boolean>

      Promise with success status