Blazer¶
Backblaze B2 claims to be the lowest cost cloud storage available. Similar to Amazon S3 it is Ideal for file archiving, off-site backups and storing on-demand game assets. It is more robust and scalable than regular web hosting with data stored across a storage cluster. Files can be managed via a web interface, the command line or via an API.
Blazer is lightweight library allowing developers to easily add uploading, retrieving and managing data in B2 capabilities tot their software.
Blazer uses the .NET framework targeting approximately the CLR 3.5 runtime making it well suited to inclusion in Unity 3D games and applications.
It provides two main APIs. A lower level .NET API in the Blazer namespace and a more Unity 3D friendly API in the Blazer.Unity namespace.
Using Blazer¶
In order to use and understand Blazer here are a bunch of examples.
Blazer Base API¶
The Blazer base API is where the bulk of the actual functionality of Blazer is implemented. For the purposes of Unity developers it should be considered an opaque library. If demand for using the part of Blazer exists it may be further documented in the future. To use Blazer within Unity; see the Blazer.Unity documentation.
- Namespace
Blazer
- Assembly
- Blazer
Blazer Unity API¶
While most of the Blazer functionality is implemented within the Blazer Base API the Blazer Unity API provides functionality more idiomatic of Unity.
General Pattern of Use¶
The important operations of the Blazer Unity API are implemented as Yieldable classes. The classes listed below are intended to be used by Unity co-routines. As such the typical pattern follows construction of a class, passing in relevent arguments to the constructor then yielding the object instance within a Unity co-routine and then a yield. After yield any expected results should be available on properties of the yielded instance.
BlazerClient client = new BlazerClient('<ACCOUNT_ID>', '<APPLICATION_KEY>');
IEnumerator MyUnityCoroutine() {
var request = new ListBucketsRequest(client);
yield return request;
var buckets = request.Buckets;
}
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Classes¶
BlazerRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
UnityEngine.CustomYieldInstruction
Constructor¶
-
class
BlazerRequest
¶ The base class providing common functionality to the worker classes perform requests to B2.
CreateBucketRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
DeleteBucketRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
DeleteFileVersionRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
Constructor¶
-
class
DeleteFileVersionRequest
¶ A function object that deletes a file version identfied by filename and unique file identifier
-
DeleteFileVersionRequest
(BlazerClient client, string fileName, string fileId)¶ Arguments: - client – The configured Blazer client
- fileName – The name of the file to delete
- fileId – The unique identifier of the file version to delete
-
DownloadFileByIdRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
Constructor¶
-
class
DownloadFileByIdRequest
¶ A function object which downloads one file from B2.
-
DownloadFileByIdRequest
(BlazerClient client, string fileId, Stream stream)¶ Arguments: - client – The configured Blazer client
- fileId – The unique identifier of the file version to download
- stream – The file stream where the download will be written
-
DownloadFileByNameRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
Constructor¶
-
class
DownloadFileByNameRequest
¶ Downloads one file when provided with a bucket name and a filename.
-
DownloadFileByNameRequest
(BlazerClient client, string bucketName, string remoteFileName, Stream fs)¶ Arguments: - client – The configured Blazer client
- bucketName – The name of the B2 bucket to download file from
- remoteFileName – The name of the file to download
- fs – The filestream to where downloaded file is written
-
GetFileInfoRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
HideFileRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
Constructor¶
-
class
HideFileRequest
¶ Hides a file so that downloading the file by name will not find the file, but the previous versions of the file are still stored.
-
HideFileRequest
(BlazerClient client, string bucketName, string fileName)¶ Arguments: - client – The configured Blazer client
- bucketName – The name of the bucket the target file resides
- fileName – The name of the file to hide
-
ListBucketsRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
ListFileNamesRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
Constructor¶
-
class
ListFileNamesRequest
¶ Lists the names of all files in a bucket, optionally starting at a given name.
This function object returns at most 1000 files name, but it can be used repeatedly to scan through all the file names in a bucket. Each time you call, it returns a “nextFileName” that can be used as a startingi point for the next call.
-
Files
()¶ Return type: List<File>
-
ListFileVersionsRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
Constructor¶
-
class
ListFileVersionsRequest
¶ Lists all the versions of all the files contained within a bucket.
-
ListFileVersionsRequest
(BlazerClient client, string bucketName, string startFileName, int maxFileCount)¶ Arguments: - client – The configured Blazer client
- bucketName – The name of the bucket to list
- startFileName – The starting file name
- maxFileCount – The maximum number of files to list
-
UpdateBucketRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
Constructor¶
-
class
UpdateBucketRequest
¶ Update an existing bucket. More specifically modifies the bucketType of an existing bucket. Can be used to allow everyone to download the contents of the bucket without providing any authorization, or to prevent anyone from downloading the contents of the bucket without a known authorization.
-
UpdateBucketRequest
(BlazerClient client, string bucketName, BucketType bucketType)¶ Arguments: - client – The configured Blazer client
- bucketName – The name of the bucket to update
- bucketType – The flag you want to assign to the bucket
-
UploadFileRequest Class¶
- Namespace
Blazer.Unity
- Assembly
- Blazer.Unity
Inheritance Hierarchy¶
Blazer.Unity.BlazerRequest
Constructor¶
-
class
UploadFileRequest
¶ Uploads one file to B2, returning its unique file identifier. Files smaller than 200MB are done in one piece. Files larger than 200MB are split into 100MB parts and uploaded separately.
-
UploadFileRequest
(BlazerClient client, string bucketName, string localFilePath, string remoteFileName, string contentType)¶ Arguments: - client – The configured Blazer client
- bucketName – The name of the bucket to upload to
- localFilePath – The path to upload file
- remoteFilePath – The name the file will receive in target bucket
- contentType – The mime type of the file
-