@backblaze-labs/b2-sdk - v0.1.0
    Preparing search index...

    Class RawClient

    Low-level client providing 1:1 bindings to all B2 native API endpoints.

    Each method maps directly to a single B2 API call. Most methods accept (apiUrl, authToken, request) and return the JSON response. Upload and download methods accept endpoint-specific parameters instead.

    Index

    Constructors

    Methods

    • Parameters

      • applicationKeyId: string

        The application key ID for authentication.

      • applicationKey: string

        The application key secret.

      • realmUrl: string = 'https://api.backblazeb2.com'

        The B2 realm URL to authenticate against.

      Returns Promise<AuthorizeAccountResponse>

      The authorization response with API URLs and credentials.

    • Parameters

      • downloadUrl: string

        The B2 download base URL.

      • authToken: string

        The authorization token.

      • fileId: string

        The unique identifier of the file to download.

      • Optionaloptions: DownloadFileOptions

        Optional download parameters for range requests and cancellation.

      Returns Promise<
          {
              body: ReadableStream<Uint8Array<ArrayBufferLike>>
              | null;
              headers: Headers;
              status: number;
          },
      >

      The response headers, streaming body, and HTTP status code.

    • Parameters

      • downloadUrl: string

        The B2 download base URL.

      • authToken: string

        The authorization token.

      • bucketName: string

        The name of the bucket containing the file.

      • fileName: string

        The name of the file to download.

      • Optionaloptions: DownloadFileOptions

        Optional download parameters for range requests and cancellation.

      Returns Promise<
          {
              body: ReadableStream<Uint8Array<ArrayBufferLike>>
              | null;
              headers: Headers;
              status: number;
          },
      >

      The response headers, streaming body, and HTTP status code.

    • Calls b2_upload_file.

      Unlike most methods, this posts directly to the uploadUrl obtained from getUploadUrl rather than the API URL.

      Parameters

      • uploadUrl: string

        The upload endpoint URL.

      • headers: UploadFileHeaders

        The request headers including authorization and content metadata.

      • body: BodyInit

        The file data to upload.

      • Optionalsignal: AbortSignal

        An optional abort signal for cancellation.

      Returns Promise<FileVersion>

      The uploaded file version metadata.

    • Calls b2_upload_part.

      Posts directly to the uploadUrl obtained from getUploadPartUrl rather than the API URL.

      Parameters

      • uploadUrl: string

        The upload endpoint URL.

      • headers: UploadPartHeaders

        The request headers including authorization and content metadata.

      • body: BodyInit

        The file data to upload.

      • Optionalsignal: AbortSignal

        An optional abort signal for cancellation.

      Returns Promise<UploadPartResponse>

      The uploaded part metadata.