A customizable B2 client for Node.js:
Scorch is a feature-packed Backblaze B2 cloud-storage client. It gives you everything you need to upload to, download from, and manage the files and buckets on your Backblaze B2 cloud storage account. ProMAX designs high-performance shared storage, media asset management, and data protection solutions for creative teams. ProMAX specializes in full-resolution asset and production workflows for local or remote video teams. All workflows can sync, backup, or archive to Backblaze B2 Cloud Storage, including Backblaze Fireball rapid ingest devices.
Usage
This library uses promises, so all actions on a
B2 instance return a promise in the following pattern:
Basic ExampleResponse Object
Each request returns an object with:
How it works
Each action (see reference below) takes arguments and constructs an axios request. You can add additional axios options at the request level using:
ReferenceUploading Large Files Example
To upload large files, you should split the file into parts (between 5MB and 5GB) and upload each part seperately.
First, you initiate the large file upload to get the fileId:
Then for each part you request an
uploadUrl , and use the response to upload the part:
Then finish the uploadUrl:
Changes
See the CHANGELOG for a history of updates.
Upgrading from 0.9.x to 1.0.x
For this update, we've switched the back end HTTP request library from
request to axios as it has better Promise and progress support built in. However, there are a couple changes that will break your code and ruin your day. Here are the changes:
Contributing
Contributions, suggestions, and questions are welcome. Please review the contributing guidelines for details.
Authors and Contributors
Current Tags
23 Versions
Last updated September 15, 2020
Backblaze B2 Cloud Storage (B2) public and private buckets can be used as origins with Fastly.
TIP: Backblaze offers an integration discount that eliminates egress costs to Fastly when using Backblaze B2 Cloud Storage as an origin. In addition, Backblaze also offers a migration program designed to offset many of the data transfer costs associated with switching from another cloud provider to Backblaze. To ensure your migration has minimal downtime, contact [email protected].
Before you begin
Before you begin the setup and configuration steps required to use B2 as an origin, keep in mind the following:
Using Backblaze B2 as an origin
To use B2 as an origin, follow the steps below.
Creating a new bucket
Data in B2 is stored in buckets. Follow these steps to create a new bucket via the B2 web interface.
TIP: The Backblaze Guide provides details on how to create a bucket using the command line tool.
NOTE: Buckets created prior to May 4th, 2020 cannot be used with the S3 Compatible API. If you do not have any S3 Compatible buckets, Backblaze recommends creating a new bucket.
Uploading files to a new bucket
Once you've created a new bucket in which to store your data, follow these steps to upload files to it via the B2 web interface.
TIP: The Backblaze Guide provides details on how to upload files using the command line tool.
Finding your bucket's assigned hostname
To set up a Fastly service that interacts with your B2, you will need to know the hostname Backblaze assigned to the bucket you created and uploaded files to.
Find your hostname in one of the following ways:
Creating a Backblaze application key for private buckets
Your Backblaze master application key controls access to all buckets and files on your Backblaze account. If you plan to use a Backblaze B2 private bucket with Fastly, you should create an application key specific to the bucket.
NOTE: The Backblaze documentation provides more information about application keys. When creating application keys for your private bucket, we recommend using the least amount of privileges possible. You can optionally set the key to expire after a certain number of seconds (up to a maximum of 1000 days or 86,400,000 seconds). If you choose an expiration, however, you'll need to periodically create a new application key and then update your Fastly configuration accordingly each time.
Via the web interface
To create an application key via the B2 web interface:
Via the command line
To create an application key from the command line, run the
create-key command as follows:
where
<bucketName> <keyName> represents the name of the bucket and key you created. For example:
The keyID and the applicationKey are the two values returned.
NOTE: Application keys created prior to May 4th, 2020 cannot be used with the S3 Compatible API.
Creating a new service
To create a new Fastly service, you must first create a new domain and then create a new host and edit it to accept traffic for B2. Instructions to do this appear in our guide to creating a new service. While completing these instructions, keep the following in mind:
Using the S3 Compatible APIBackblaze B2 Cheaper ThanUsing the S3 Compatible API with public objects
To use the S3 Compatible API with public objects, you will need to make sure the
Host header contains the name of your B2 Bucket. There are two ways to do this, both of which require you to get your region name which will be the 2nd part of your S3 Endpoint. So if your S3 Endpoint is s3.us-west-000.backblazeb2.com , this means your region will be us-west-000 .
Using the S3 Compatible API with private objects
To use a Backblaze B2 private bucket with Fastly, you must implement version 4 of Amazon’s header-based authentication. You can do this using custom VCL.
Start by obtaining the following information from Backblaze (see Creating a Backblaze application key for private buckets):
Once you have this information, you can configure your Fastly service to authenticate against your B2 bucket using header authentication by calculating the appropriate header value in VCL.
Start by creating a regular VCL snippet. Give it a meaningful name, such as
AWS protected origin . When you create the snippet, select within subroutine to specify its placement and choose miss as the subroutine type. Then, populate the VCL field with the following code (be sure to change specific values as noted to ones relevant to your own AWS bucket):
Using the B2 APIPublic Objects
You'll need to make sure the URL contains your bucket name. There are two ways to do this.
Backblaze B2 Client Windows
Private Objects
NOTE: You will need to regenerate an authorization token and update your Fastly configuration before the end of the expiration time. A good way to do this would be through Fastly's versionless Edge Dictionaries.
Passing a generated token to Backblaze
There are two ways you can pass the generated token to Backblaze. The first is using an
Authorization header. This is the recommended method.
Alternatively, the second way is to pass an
Authorization query parameter.
Scorch 1 1 2 – Backblaze B2 Storage Client Access
Backblaze B2 Integration
This article describes an integration with a service provided by a third party. Please see our note on integrations.
Backblaze B2 Backup ClientBack to TopComments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |