Vana SDK - v2.2.2
    Preparing search index...

    Interface StorageProvider

    Defines interface for storage provider implementations.

    Abstracts storage backends (IPFS, Google Drive, Pinata) behind common interface for encrypted file operations.

    class MyStorage implements StorageProvider {
    async upload(file: Blob): Promise<StorageUploadResult> {
    const url = await uploadToService(file);
    return { url, size: file.size, contentType: file.type };
    }

    async download(url: string): Promise<Blob> {
    return fetch(url).then(r => r.blob());
    }
    }
    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