BlobHelper 4.1.6
dotnet add package BlobHelper --version 4.1.6
NuGet\Install-Package BlobHelper -Version 4.1.6
<PackageReference Include="BlobHelper" Version="4.1.6" />
paket add BlobHelper --version 4.1.6
#r "nuget: BlobHelper, 4.1.6"
// Install BlobHelper as a Cake Addin #addin nuget:?package=BlobHelper&version=4.1.6 // Install BlobHelper as a Cake Tool #tool nuget:?package=BlobHelper&version=4.1.6
BlobHelper
BlobHelper is a common, consistent storage interface for Microsoft Azure, Amazon S3, S3 compatible storage (i.e. Minio, Less3), Kvpbase, and local filesystem written in C#.
Help, Feedback, Contribute
If you have any issues or feedback, please file an issue here in Github. We'd love to have you help by contributing code for new features, optimization to the existing codebase, ideas for future releases, or fixes!
Overview
This project was built to provide a simple interface over external storage to help support projects that need to work with potentially multiple storage providers. It is by no means a comprehensive interface, rather, it supports core methods for creation, retrieval, deletion, metadata, and enumeration.
Contributors
- @phpfui for adding the original code for BLOB copy functionality
- @Revazashvili for fixes related to byte array instantiation, Azure, and refactoring
- @courtzzz for keeping the region list updated
New in v4.1.x
- Refactor recommendation by @Revazashvili to interface and implementation
- Minor class name change;
Blobs
becomesBlobClient
Example Project
Refer to the Test
project for exercising the library.
Getting Started - AWS S3
using BlobHelper;
AwsSettings settings = new AwsSettings(
accessKey,
secretKey,
AwsRegion.USWest1,
bucket);
BlobClient blobs = new BlobClient(settings);
Getting Started - AWS S3 Compatible Storage (Minio, Less3, etc)
using BlobHelper;
AwsSettings settings = new AwsSettings(
endpoint, // http://localhost:8000/
true, // enable or disable SSL
accessKey,
secretKey,
AwsRegion.USWest1,
bucket,
baseUrl // i.e. http://localhost:8000/{bucket}/{key}
);
BlobClient blobs = new BlobClient(settings);
Getting Started - Azure
using BlobHelper;
AzureSettings settings = new AzureSettings(
accountName,
accessKey,
"https://[accountName].blob.core.windows.net/",
containerName);
BlobClient blobs = new BlobClient(settings);
Getting Started - Komodo
using BlobHelper;
KomodoSettings settings = new KomodoSettings(
"http://localhost:9090/",
indexGuid,
apiKey);
BlobClient blobs = new BlobClient(settings);
Getting Started - Kvpbase
using BlobHelper;
KvpbaseSettings settings = new KvpbaseSettings(
"http://localhost:8000/",
userGuid,
containerName,
apiKey);
BlobClient blobs = new BlobClient(settings);
Getting Started - Disk
using BlobHelper;
DiskSettings settings = new DiskSettings("blobs");
BlobClient blobs = new BlobClient(settings);
Getting Started (Byte Arrays for Smaller Objects)
await blobs.Write("test", "text/plain", "This is some data"); // throws IOException
byte[] data = await blobs.Get("test"); // throws IOException
bool exists = await blobs.Exists("test");
await blobs.Delete("test");
Getting Started (Streams for Larger Objects)
// Writing a file using a stream
FileInfo fi = new FileInfo(inputFile);
long contentLength = fi.Length;
using (FileStream fs = new FileStream(inputFile, FileMode.Open))
{
await _Blobs.Write("key", "content-type", contentLength, fs); // throws IOException
}
// Downloading to a stream
BlobData blob = await _Blobs.GetStream(key);
// read blob.ContentLength bytes from blob.Data
Metadata and Enumeration
// Get BLOB metadata
BlobMetadata md = await _Blobs.GetMetadata("key");
// Enumerate BLOBs
EnumerationResult result = await _Blobs.Enumerate();
// list of BlobMetadata contained in result.Blobs
// continuation token in result.NextContinuationToken
Copying BLOBs from Repository to Repository
If you have multiple storage repositories and wish to move BLOBs from one repository to another, use the BlobCopy
class (refer to the Test.Copy
project for a full working example).
Thanks to @phpfui for contributing code and the idea for this enhancement!
Blobs from = new Blobs(new DiskSettings("./disk1/")); // assume some files are here
Blobs to = new Blobs(new DiskSettings("./disk2/"));
BlobCopy copy = new BlobCopy(from, to);
CopyStatistics stats = copy.Start();
/*
{
"Success": true,
"Time": {
"Start": "2021-12-22T18:44:42.9098249Z",
"End": "2021-12-22T18:44:42.9379215Z",
"TotalMs": 28.1
},
"ContinuationTokens": 0,
"BlobsEnumerated": 12,
"BytesEnumerated": 1371041,
"BlobsRead": 12,
"BytesRead": 1371041,
"BlobsWritten": 12,
"BytesWritten": 1371041,
"Keys": [
"filename.txt",
...
]
}
*/
Version History
Refer to CHANGELOG.md for version history.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- AWSSDK.Core (>= 3.7.204.4)
- AWSSDK.Extensions.NETCore.Setup (>= 3.7.7)
- AWSSDK.S3 (>= 3.7.205.13)
- Azure.Storage.Blobs (>= 12.18.0)
- Microsoft.CSharp (>= 4.7.0)
- System.Text.Json (>= 7.0.3)
-
.NETFramework 4.8
- AWSSDK.Core (>= 3.7.204.4)
- AWSSDK.Extensions.NETCore.Setup (>= 3.7.7)
- AWSSDK.S3 (>= 3.7.205.13)
- Azure.Storage.Blobs (>= 12.18.0)
- Microsoft.CSharp (>= 4.7.0)
- System.Text.Json (>= 7.0.3)
-
.NETStandard 2.1
- AWSSDK.Core (>= 3.7.204.4)
- AWSSDK.Extensions.NETCore.Setup (>= 3.7.7)
- AWSSDK.S3 (>= 3.7.205.13)
- Azure.Storage.Blobs (>= 12.18.0)
- Microsoft.CSharp (>= 4.7.0)
- System.Text.Json (>= 7.0.3)
-
net6.0
- AWSSDK.Core (>= 3.7.204.4)
- AWSSDK.Extensions.NETCore.Setup (>= 3.7.7)
- AWSSDK.S3 (>= 3.7.205.13)
- Azure.Storage.Blobs (>= 12.18.0)
- Microsoft.CSharp (>= 4.7.0)
- System.Text.Json (>= 7.0.3)
-
net7.0
- AWSSDK.Core (>= 3.7.204.4)
- AWSSDK.Extensions.NETCore.Setup (>= 3.7.7)
- AWSSDK.S3 (>= 3.7.205.13)
- Azure.Storage.Blobs (>= 12.18.0)
- Microsoft.CSharp (>= 4.7.0)
- System.Text.Json (>= 7.0.3)
-
net8.0
- AWSSDK.Core (>= 3.7.204.4)
- AWSSDK.Extensions.NETCore.Setup (>= 3.7.7)
- AWSSDK.S3 (>= 3.7.205.13)
- Azure.Storage.Blobs (>= 12.18.0)
- Microsoft.CSharp (>= 4.7.0)
- System.Text.Json (>= 7.0.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on BlobHelper:
Package | Downloads |
---|---|
Komodo.Classes
Do not install directly. Supporting classes for Komodo. Please either install Komodo.Daemon to integrate search within your application, or Komodo.Server to run a standalone server. Komodo is an information search, metadata, storage, and retrieval platform. |
|
Komodo.Core
Komodo core libraries for crawling (file, object, web, database), parsing (JSON, XML, SQL, Sqlite, HTML, text), postings (inverted index, token extraction), indexing (search), metadata generation, and integrating within your application. Komodo is an information search, metadata, storage, and retrieval platform. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
4.1.6 | 1,698 | 2/9/2024 |
4.1.5 | 2,490 | 10/19/2023 |
4.1.3 | 5,860 | 7/7/2023 |
4.1.2 | 2,588 | 6/14/2023 |
4.1.1 | 769 | 5/16/2023 |
4.1.0 | 728 | 5/14/2023 |
4.0.7 | 1,909 | 5/12/2023 |
4.0.6 | 760 | 5/9/2023 |
4.0.4 | 1,573 | 4/11/2023 |
4.0.3 | 1,706 | 2/1/2023 |
4.0.2 | 2,785 | 1/11/2023 |
4.0.1 | 1,313 | 1/7/2023 |
2.3.1 | 1,112 | 1/4/2023 |
2.3.0 | 1,058 | 12/27/2022 |
2.2.4.2 | 4,904 | 9/16/2022 |
2.2.4.1 | 2,143 | 9/4/2022 |
2.2.4 | 1,419 | 8/31/2022 |
2.2.3 | 966 | 8/31/2022 |
2.2.2 | 2,000 | 8/11/2022 |
2.2.0.1 | 10,886 | 12/22/2021 |
2.1.4.5 | 818 | 12/20/2021 |
2.1.4.4 | 1,363 | 12/9/2021 |
2.1.4.2 | 4,931 | 11/14/2021 |
2.1.4.1 | 2,162 | 11/1/2021 |
2.1.4 | 921 | 10/15/2021 |
2.1.3 | 6,281 | 6/15/2021 |
2.1.2 | 961 | 6/15/2021 |
2.1.1 | 1,096 | 6/7/2021 |
2.0.4.4 | 11,232 | 11/16/2020 |
2.0.4.3 | 3,375 | 11/15/2020 |
2.0.4.2 | 12,845 | 9/10/2020 |
2.0.4.1 | 6,405 | 8/1/2020 |
2.0.4 | 6,289 | 7/29/2020 |
2.0.3.8 | 11,093 | 7/24/2020 |
2.0.3.7 | 1,427 | 7/14/2020 |
2.0.3.6 | 1,392 | 7/14/2020 |
2.0.3.5 | 3,602 | 7/14/2020 |
2.0.3.4 | 2,074 | 6/22/2020 |
2.0.3.3 | 1,104 | 6/22/2020 |
2.0.3.2 | 1,240 | 6/22/2020 |
2.0.3 | 1,095 | 6/21/2020 |
2.0.2 | 66,456 | 2/29/2020 |
2.0.1 | 50,311 | 9/19/2019 |
1.3.5 | 1,170 | 9/16/2019 |
1.3.4 | 1,301 | 8/17/2019 |
1.3.3 | 1,284 | 8/17/2019 |
1.3.2 | 1,203 | 8/17/2019 |
1.3.1 | 1,306 | 8/16/2019 |
1.3.0 | 1,284 | 8/3/2019 |
1.2.2 | 1,365 | 6/10/2019 |
1.2.1 | 1,801 | 4/23/2019 |
1.1.5 | 1,474 | 4/23/2019 |
1.1.4 | 1,505 | 4/20/2019 |
1.1.2 | 1,375 | 4/20/2019 |
1.1.0 | 2,150 | 3/12/2019 |
1.0.4 | 1,616 | 7/26/2018 |
1.0.3 | 1,579 | 7/19/2018 |
1.0.2 | 1,583 | 7/8/2018 |
1.0.0 | 1,645 | 3/27/2018 |
Refactor based on recommendation from @Revazashvili