Skip to main content
Module

x/actionify/deploy/modules/backblaze.ts>BackBlaze

Create and manage your GitHub workflows with TypeScript and Deno.
Latest
class BackBlaze
import { BackBlaze } from "https://deno.land/x/actionify@0.3.0/deploy/modules/backblaze.ts";

Constructors

new
BackBlaze(props: BackBlazeProps)

Properties

readonly
downloadUrl

Methods

authorizeAccount(): Promise<JsonResponse<AuthorizeData, "b2_authorize_account">>

Used to log in to the B2 API. Saves an authorization token that can be used for account-level operations, and a URL that should be used as the base URL for subsequent API calls.

You can use either the master application key or a normal application key.

You'll find the master application key on the B2 Cloud Storage Buckets page on the web site. When using the master application key, use your "master application key ID" and the "application key" you got from the site.

Master Application Key: This is the first key you have access to, it is available on the web application. This key has all capabilities, access to all buckets, and has no file prefix restrictions or expiration.

Application Key(s) [non-master]: These are other keys created by you and can be limited to a bucket, with a specific file prefix and can expire. Normal application keys come from the b2_create_key call. When using one of them, the "application key ID" and "application key" are the ones returned when you created the key.

cancelLargeFile(fileId: string): Promise<JsonResponse<CancelLargeFileData, "b2_cancel_large_file">>

Cancels the upload of a large file, and deletes all of the parts that have been uploaded.

This will return an error if there is no active upload with the given file ID.

This will also throw an error if the instance has not been authenticated or the token doesn't have the writeFiles capability.

createBucket(props: CreateBucketProps): Promise<JsonResponse<CreateBucketData, "b2_create_bucket">>
fileUrl(bucketName: string, fileName: string)

Get the download path for the provided file.

File should not have a leading /.

getUploadUrl(bucketId: string): Promise<JsonResponse<GetUploadUrlData, "b2_get_upload_url">>

Gets an URL to use for uploading files.

When you upload a file to B2, you must call getUploadUrl first to get the URL for uploading. Then, you use uploadFile on this URL to upload your file.

An uploadUrl and upload authorizationToken are valid for 24 hours or until the endpoint rejects an upload, see uploadFile. You can upload as many files to this URL as you need. To achieve faster upload speeds, request multiple uploadUrls and upload your files to these different endpoints in parallel.

listFileNames(props: ListFileNameProps): Promise<JsonResponse<ListFileNameData, "b2_list_file_names">>

Lists the names of all files in a bucket, starting at a given name.

This call returns at most 1000 file names per transaction, but it can be called repeatedly to scan through all of the file names in a bucket. Each time you call, it returns a "nextFileName" that can be used as the starting point for the next call.

There may be many file versions for the same name, but this call will return each name only once. Files that have been hidden will not be returned; to see all versions of a file, including hide markers, use listFileVersions() instead.

upload(file: Uint8Array, props: UploadProps)

Shorthand for uploading a file.

uploadFile(file: Uint8Array, props: UploadFileProps): Promise<JsonResponse<FileData, "b2_upload_file">>

Uploads one file to B2, returning its unique file ID.