Stratal API Reference
    Preparing search index...

    Interface IStorageProvider

    Storage provider interface Defines the contract for storage implementations (R2, S3, GCS, etc.)

    interface IStorageProvider {
        chunkedUpload(
            body: StreamingBlobPayloadInputTypes | undefined,
            path: string,
            options: Omit<UploadOptions, "size"> & { size?: number },
        ): Promise<
            {
                disk: string;
                fullPath: string;
                mimeType: string;
                path: string;
                size: number;
                uploadedAt: Date;
            },
        >;
        delete(path: string): Promise<void>;
        download(path: string): Promise<DownloadResult>;
        exists(path: string): Promise<boolean>;
        getPresignedUrl(
            path: string,
            method: "GET" | "PUT" | "DELETE" | "HEAD",
            expiresIn: number,
        ): Promise<
            {
                expiresAt: Date;
                expiresIn: number;
                method: "GET"
                | "PUT"
                | "DELETE"
                | "HEAD";
                url: string;
            },
        >;
        upload(
            body: StreamingBlobPayloadInputTypes | undefined,
            path: string,
            options: UploadOptions,
        ): Promise<
            {
                disk: string;
                fullPath: string;
                mimeType: string;
                path: string;
                size: number;
                uploadedAt: Date;
            },
        >;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Chunked upload for streaming data without known size Uses multipart upload under the hood for reliability

      Parameters

      • body: StreamingBlobPayloadInputTypes | undefined

        Content to upload (stream or buffer)

      • path: string

        Full path including disk root

      • options: Omit<UploadOptions, "size"> & { size?: number }

        Upload options (mimeType required, size optional)

      Returns Promise<
          {
              disk: string;
              fullPath: string;
              mimeType: string;
              path: string;
              size: number;
              uploadedAt: Date;
          },
      >

      Upload result with metadata

    • Generate a presigned URL for temporary access

      Parameters

      • path: string

        Full path to the file

      • method: "GET" | "PUT" | "DELETE" | "HEAD"

        HTTP method (GET, PUT, DELETE, HEAD)

      • expiresIn: number

        Expiry time in seconds (1-604800)

      Returns Promise<
          {
              expiresAt: Date;
              expiresIn: number;
              method: "GET"
              | "PUT"
              | "DELETE"
              | "HEAD";
              url: string;
          },
      >

      Presigned URL result

    • Upload content to storage

      Parameters

      • body: StreamingBlobPayloadInputTypes | undefined

        Content to upload (stream, buffer, or string)

      • path: string

        Full path including disk root

      • options: UploadOptions

        Upload options including size and mime type

      Returns Promise<
          {
              disk: string;
              fullPath: string;
              mimeType: string;
              path: string;
              size: number;
              uploadedAt: Date;
          },
      >

      Upload result with metadata