Backblaze 2
Posted : admin On 1/29/2022- METHODS
- METHODS
Backblaze::B2 - interface to the Backblaze B2 API
Backblaze::B2->new %options
Backblaze B2: Backblaze B2 is a cloud storage service which is provided by Backblaze Incorporation. It is quite similar to the Amazon S3 and other cloud storage services. It is an object storage service. It was launched by Backblaze Incorporation in 2015. It offers 10 GB free storage space. Backblaze said that it added over 30,000 drives in 2020 that were sized at 14 TB or larger, and they performed well overall, with an AFR of 0.89%, beating out the 12 TB drives’ AFR of 0.98%. Read original article. Is a cloud storage and data backup company, founded in 2007 by Gleb Budman, Billy Ng, Nilay Patel, Brian Wilson, Tim Nufire, Damon Uyeda, and Casey Jones. Its two main products are their B2 Cloud Storage and Computer Backup services, targeted at both business and personal markets.
Allows you to specify the API version. The current default is v1
, which corresponds to the Backblaze B2 API version 1 as documented at https://www.backblaze.com/b2/docs/.
B2.credentials
This file should live in your home directory with the application key and the account key:
Backblaze::B2::v1 - Backblaze B2 API account
->new %options
Creates a new instance. Depending on whether you pass in <Backblaze::B2::v1::Synchronous
> or <Backblaze::B2::v1::AnyEvent
>, you will get a synchronous or asynchronous API.
The synchronous API is what is documented here, as this is the most likely use case.
The asynchronous API is identical to the synchronous API in spirit, but will return Promises . These condvars usually return two or more parameters upon completion:
The asynchronous API puts the burden of error handling into your code.
->buckets
Returns a list of Backblaze::B2::Bucket objects associated with the B2 account.
->bucket_from_id
Returns a Backblaze::B2::Bucket object that has the given ID. It does not make an HTTP request to fetch the name and status of that bucket.
->create_bucket
Creates a new bucket and returns it.
->api
Returns the underlying API object
->files( %options )
Lists the files contained in this bucket
By default it returns only the first 1000 files, but see the allFiles
parameter.
allFiles
Passing in a true value for this parameter will make as many API calls as necessary to fetch all files.
->upload_file( %options )
Uploads a file into this bucket, potentially creating a new file version.
file
Local name of the source file. This file will be loaded into memory in one go.
target_file
Name of the file on the B2 API. Defaults to the local name.
Backblaze 2fa
The target file name will have backslashes replaced by forward slashes to comply with the B2 API.
mime_type
Content-type of the stored file. Defaults to autodetection by the B2 API.
content
If you don't have the local content in a file on disk, you can pass the content in as a string.
mtime
Time in miliseconds since the epoch to when the content was created. Defaults to the current time.
sha1
Hexdigest of the SHA1 of the content. If this is missing, the SHA1 will be calculated upon upload.
->download_file_by_name( %options )
Downloads a file from this bucket by name:
This saves you searching through the list of existing files if you already know the filename.
->get_download_authorization( %options )
Downloads a file from this bucket by name:
This returns an authorization token that can download files with the given prefix.
->api
Returns the underlying API object
->files( %options )
Blaze Storage
Lists the files contained in this bucket
By default it returns only the first 1000 files, but see the allFiles
parameter.
allFiles
Passing in a true value for this parameter will make as many API calls as necessary to fetch all files.
->upload_file( %options )
Uploads a file into this bucket, potentially creating a new file version.
file
Local name of the source file. This file will be loaded into memory in one go.
target_file
B2 Pricing
Name of the file on the B2 API. Defaults to the local name.
The target file name will have backslashes replaced by forward slashes to comply with the B2 API.
mime_type
Content-type of the stored file. Defaults to autodetection by the B2 API.
Backblaze 2020

content
If you don't have the local content in a file on disk, you can pass the content in as a string.
mtime
Time in miliseconds since the epoch to when the content was created. Defaults to the current time.
sha1
Hexdigest of the SHA1 of the content. If this is missing, the SHA1 will be calculated upon upload.
->download_file_by_name( %options )
Backblaze 20tb
Downloads a file from this bucket by name:
This saves you searching through the list of existing files if you already know the filename.
->api
Returns the underlying API object
Backblaze 20
To install Backblaze::B2, copy and paste the appropriate command in to your terminal.
Backblaze 2.0
For more information on module installation, please visit the detailed CPAN module installation guide.