All Projects → microcompiler → backblaze

microcompiler / backblaze

Licence: MIT license
Backblaze.Agent is a high-performance .NET Core implementation of the Backblaze B2 Cloud Storage API.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to backblaze

Rclone
"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Yandex Files
Stars: ✭ 30,541 (+95340.63%)
Mutual labels:  s3, cloud-storage, backblaze-b2
poto
multi cloud storage to image gallery + image proxy + file api - 350 LOC.
Stars: ✭ 20 (-37.5%)
Mutual labels:  s3, cloud-storage
go-storage
A vendor-neutral storage library for Golang: Write once, run on every storage service.
Stars: ✭ 387 (+1109.38%)
Mutual labels:  s3, cloud-storage
cottoncandy
sugar for s3
Stars: ✭ 33 (+3.13%)
Mutual labels:  s3, cloud-storage
b2-sdk-php
SDK for Backblaze's B2 storage service.
Stars: ✭ 75 (+134.38%)
Mutual labels:  backblaze, backblaze-b2
go-drive
A simple cloud drive mapping web app supports local, FTP/SFTP, S3, OneDrive, WebDAV, Google Drive.
Stars: ✭ 184 (+475%)
Mutual labels:  s3, cloud-storage
Goofys
a high-performance, POSIX-ish Amazon S3 file system written in Go
Stars: ✭ 3,932 (+12187.5%)
Mutual labels:  s3, cloud-storage
B2.NET
.NET library for Backblaze's B2 Cloud Storage
Stars: ✭ 63 (+96.88%)
Mutual labels:  backblaze, backblaze-b2
Minio Hs
MinIO Client SDK for Haskell
Stars: ✭ 39 (+21.88%)
Mutual labels:  s3, cloud-storage
Go Storage
An application-oriented unified storage layer for Golang.
Stars: ✭ 87 (+171.88%)
Mutual labels:  s3, cloud-storage
rclone-drive
☁️Simple web cloud storage based on rclone, transform cloud storage (s3, google drive, one drive, dropbox) into own custom web-based storage
Stars: ✭ 30 (-6.25%)
Mutual labels:  s3, cloud-storage
Sftpgo
Fully featured and highly configurable SFTP server with optional HTTP, FTP/S and WebDAV support - S3, Google Cloud Storage, Azure Blob
Stars: ✭ 3,534 (+10943.75%)
Mutual labels:  s3, cloud-storage
S3fs Fuse
FUSE-based file system backed by Amazon S3
Stars: ✭ 5,733 (+17815.63%)
Mutual labels:  s3, cloud-storage
Cloudexplorer
Cloud Explorer
Stars: ✭ 170 (+431.25%)
Mutual labels:  s3, cloud-storage
CloudHunter
Find unreferenced AWS S3 buckets which have CloudFront CNAME records pointing to them
Stars: ✭ 31 (-3.12%)
Mutual labels:  buckets, s3
kafka-connect-fs
Kafka Connect FileSystem Connector
Stars: ✭ 107 (+234.38%)
Mutual labels:  s3
SimpleCad
A basic CAD-like control surface for winforms.
Stars: ✭ 81 (+153.13%)
Mutual labels:  net
mediasort
Upload manager using Laravel's built-in Filesystem/Cloud Storage
Stars: ✭ 20 (-37.5%)
Mutual labels:  s3
understory.garden
Understory is a digital garden, a micro-publishing space for you to plant the seeds of your ideas and grow them into bi-directionally linked web portals. It's a social zettelkasten that lets users use Web Monetization to get paid when people spend time with their content.
Stars: ✭ 27 (-15.62%)
Mutual labels:  pod
Sree
S3 client for human beings
Stars: ✭ 55 (+71.88%)
Mutual labels:  s3

Backblaze Agent for .NET Core

NuGet Version NuGet Downloads

The Backblaze Agent (client) for .NET Core is an implementation of the Backblaze B2 Cloud Storage API. Backblaze B2 Cloud Storage provides the cheapest cloud storage available on the internet. Backblaze B2 Cloud Storage is ¼ of the price of other storage providers. Give it a try as the first 10 GB of storage is free.

Features

  • Full support for Backblaze B2 Cloud Storage API v2 including files, accounts, keys and buckets.
  • Built targeting .NET Standard 2.0 which means Backblaze Agent will work on Windows, Mac and Linux systems.
  • Seamlessly intergrates with .NET Core Dependency Injection and HttpClientFactory to implement resilient requests.
  • Simple in-memory response cache using MemoryCache.
  • Large file support with low memory allocation and IProgress status.
  • Native support of task based programming model (async/await).

For feature requests and bug reports, please open an issue on GitHub.

Installation via .NET CLI

To install Backblaze.Agent run the following command:

> dotnet add package Backblaze.Agent

Getting Started

Work in Progress! Whilst we encourage users to play with the samples and test programs, this project has not yet reached a stable state.

You will need an key_id and an application_key to configure Backblaze Agent. You can obtain these from the Backblaze B2 Cloud Storage portal. See the Sample Project for an example of how to use this packages.

Adding Backblaze Agent to Services

public void ConfigureServices(IServiceCollection services)
{
    services.AddBackblazeAgent(options =>
    {
    options.KeyId = "[key_id]";
    options.ApplicationKey = "[application_key]";
    });
}

To get a list of backblaze buckets simply inject IStorageClient into your class and call the async client.

public class IndexModel : PageModel
{
  private readonly IStorageClient _storage;

  public IndexModel(IStorageClient storage)
  {
      _storage = storage;
  }

  [BindProperty]
  public IEnumerable<BucketItem> Buckets { get; private set; }

  public async Task<IActionResult> OnGetAsync()
  {
    Buckets = await _storage.Buckets.GetAsync();

    if (Buckets == null)
    {
      return NotFound();
    }

    return Page();
  }
}

Initializing Backblaze Client without Dependency Injection

Install the following packages:

> dotnet add package Backblaze.Client
> dotnet add package Microsoft.Extensions.Caching.Memory
> dotnet add package Microsoft.Extensions.Logging.Debug

Sample Code:

class Program
{
  private static IStorageClient Client;

  static async Task Main(string[] args)
  {
    try
    {
      var options = new ClientOptions();

      var loggerFactory = LoggerFactory.Create(builder =>
      {
        builder
          .AddFilter("Bytewizer.Backblaze", LogLevel.Trace)
          .AddDebug();
      });

      var cache = new MemoryCache(new MemoryCacheOptions());

      Client = new BackblazeClient(options, loggerFactory, cache);  
      await Client.ConnectAsync("[key_id]", "[application_key]");

      var buckets = await Client.Buckets.GetAsync();

      foreach (var bucket in buckets)
        Console.WriteLine($"Bucket Name: {bucket.BucketName} - Type: {bucket.BucketType}");   
    }
    catch (Exception ex)
    {
      Console.Error.WriteLine(ex.Message);
    }
  }
}

Initializing Backblaze Client without Dependency Injection, Logging or Caching

Install the following package:

> dotnet add package Backblaze.Client

Sample Code:

class Program
{
  private static IStorageClient Client;

  static void Main(string[] args)
  {
    try
    {
      Client = new BackblazeClient();
      Client.Connect("[key_id]", "[application_key]");

      var buckets = Client.Buckets.GetAsync().GetAwaiter().GetResult();

      foreach (var bucket in buckets)
        Console.WriteLine($"Bucket Name: {bucket.BucketName} - Type: {bucket.BucketType}");
    }
    catch (Exception ex)
    {
      Console.Error.WriteLine(ex.Message);
    }
  }
}

Basic Usage

Upload File Stream

foreach (var filePath in Directory.GetFiles(@"c:\my\directory"))
{
  using (var stream = File.OpenRead(filePath))
  {
    var results = await Client.UploadAsync("[BucketId]", new FileInfo(filePath).Name, stream);
  }
}

Download File Stream

var files = new string[] { @"c:\my\directory\file1.txt", "file2.bat" };

foreach (var fileName in files)
{
  using (var stream = File.Create(fileName))
  {
      var results = await Client.DownloadAsync("[BucketName]", fileName, stream);
  }
}

Microsoft Logging Integration

Install the Microsoft.Extensions.Logging packages:

> dotnet add package Microsoft.Extensions.Logging.Debug

Tracing to the Debug window can be enabled with the following code:

services.AddLogging(builder =>
{
    builder.AddDebug();
    builder.AddFilter("Bytewizer.Backblaze", LogLevel.Trace);
});

Agent Options

services.AddBackblazeAgent(options =>
{
  options.KeyId = "[key_id]";
  options.ApplicationKey = "[application_key]";
});

The following table describes the Agent Options available:

Option Name Default Description
KeyId --- Required - The key identifier used to authenticate.
ApplicationKey --- Required - The secret part of the key used to authenticate.
HandlerLifetime 600 The time in seconds that the message handler instance can be reused.
Timeout 600 The time in seconds to wait before the client request times out.
RetryCount 5 The number of times the client will retry failed requests before timing out.
RequestMaxParallel 10 The maximum number of parallel request connections established.
DownloadMaxParallel 5 The maximum number of parallel download connections established.
DownloadCutoffSize 100MB Download cutoff size for switching to chunked parts in bytes.
DownloadPartSize 100MB Download part size of chunked parts in bytes.
UploadMaxParallel 3 The maximum number of parallel upload connections established.
UploadCutoffSize 100MB Upload cutoff size for switching to chunked parts in bytes.
UploadPartSize 100MB Upload part size of chunked parts in bytes.
AutoSetPartSize false Use the recommended part size returned by the Backblaze service.
ChecksumDisabled false This is for testing use only and not recomended for production environments.
TestMode --- This is for testing use only and not recomended for production environments.

Test Mode Options

services.AddBackblazeAgent(options =>
{
  // This is for testing use only and not recomended for production environments.
  options.TestMode = "fail_some_uploads";  
});

The following test mode options are available to verify that your code correctly handles error conditions.

Option String Description
fail_some_uploads Random uploads fail or become rejected by the service.
expire_some_account_authorization_tokens Random account authorization tokens expire.
force_cap_exceeded Cap exceeded conditions are forced.

Integration Tests

You will need an key_id and an application_key to configure Backblaze Test Agent settings.json file.

Disclaimer

All source, documentation, instructions and products of this project are provided as-is without warranty. No liability is accepted for any damages, data loss or costs incurred by its use.

Branches

master - This is the branch containing the latest release - no contributions should be made directly to this branch.

develop - This is the development branch to which contributions should be proposed by contributors as pull requests. This development branch will periodically be merged to the master branch, and be released to NuGet Gallery.

Contributions

Contributions to this project are always welcome. Please consider forking this project on GitHub and sending a pull request to get your improvements added to the original project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].