Options
All
  • Public
  • Public/Protected
  • All
Menu

Class B2

Hierarchy

  • B2

Index

Properties

Accessors

Methods

Properties

Static Readonly apiVersion

apiVersion: string = "v2"

Static Readonly userAgent

userAgent: string = `b2-js/${version}+nodejs/${process.version} https://git.io/b2-js`

Accessors

partSize

  • get partSize(): number
  • set partSize(size: number): void
  • Backblaze allows uploading files as a single-part or as multiple parts. However, you must know the length of each file in advance, and you cannot use chunked-encoding. Single-part uploads are generally faster for smaller files. Backblaze recommends a part-size, which is automatically used.

    Each part must be read into memory.

    You can configure this, to a minimum of b2.auth.absoluteMinimumPartSize.

    Returns number

  • Backblaze allows uploading files as a single-part or as multiple parts. However, you must know the length of each file in advance, and you cannot use chunked-encoding. Single-part uploads are generally faster for smaller files. Backblaze recommends a part-size, which is automatically used.

    Each part must be read into memory.

    You can configure this, to a minimum of b2.auth.absoluteMinimumPartSize.

    Parameters

    • size: number

    Returns void

Methods

bucket

  • Get a bucket by name.

    const bucket = await b2.bucket("js-testing-bucket");

    Parameters

    • name: string

    Returns Promise<Bucket>

  • Get a bucket by id.

    const bucket = await b2.bucket({bucketId: "BUCKET_ID"});

    Parameters

    Returns Promise<Bucket>

callApi

  • callApi(operationName: string, request: RequestInit, opts?: RequestOptions): Promise<Response>
  • Call a b2 operation by name

    Parameters

    • operationName: string
    • request: RequestInit
    • Default value opts: RequestOptions = {}

    Returns Promise<Response>

Static authorize

  • Create a new B2 client by authorizing with the API.

    import B2 from "./src/b2";
    
    const b2 = await B2.authorize({
      applicationKeyId: "KEY_ID",
      applicationKey: "SECRET_KEY"
    });

    Parameters

    Returns Promise<B2>

Generated using TypeDoc