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

    Delegates storage operations to your server endpoints

    This provider is completely agnostic about the actual storage backend used by your server. It simply proxies upload and download requests to your configured endpoints, allowing you to implement any storage strategy (IPFS, S3, local filesystem, etc.) on the server side while maintaining a consistent client interface.

    const serverStorage = new ServerProxyStorage({
    uploadUrl: "/api/files/upload",
    downloadUrl: "/api/files/download"
    });

    // Upload file through your server
    const identifier = await serverStorage.upload(fileBlob, { name: "document.pdf" });

    // Download file through your server
    const file = await serverStorage.download(identifier);

    Implements

    Index

    Methods

    • Uploads a file through your server endpoint

      Parameters

      • file: Blob

        The file to upload

      • Optionalfilename: string

        Optional custom filename

      Returns Promise<StorageUploadResult>

      Promise that resolves to the server-provided identifier

      This method sends the file to your configured upload endpoint via FormData. Your server is responsible for handling the actual storage implementation and must return a JSON response with success: true and an identifier field.

      When the upload fails or server returns an error

      const identifier = await serverStorage.upload(fileBlob, { name: "report.pdf" });
      console.log("File uploaded with identifier:", identifier);
    • Downloads a file through your server endpoint

      Parameters

      • url: string

        The server-provided URL or identifier from upload

      Returns Promise<Blob>

      Promise that resolves to the downloaded file content

      This method sends the identifier to your configured download endpoint via POST request. Your server is responsible for retrieving the file from your storage backend and returning the file content as a blob response.

      When the download fails or file is not found

      const fileBlob = await serverStorage.download("file-123");
      const url = URL.createObjectURL(fileBlob);