VOOZH about

URL: https://www.nuget.org/packages/ColinChang.OssHelper/

⇱ NuGet Gallery | ColinChang.OssHelper 1.2.8




👁 Image
ColinChang.OssHelper 1.2.8

dotnet add package ColinChang.OssHelper --version 1.2.8
 
 
NuGet\Install-Package ColinChang.OssHelper -Version 1.2.8
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ColinChang.OssHelper" Version="1.2.8" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ColinChang.OssHelper" Version="1.2.8" />
 
Directory.Packages.props
<PackageReference Include="ColinChang.OssHelper" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ColinChang.OssHelper --version 1.2.8
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ColinChang.OssHelper, 1.2.8"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ColinChang.OssHelper@1.2.8
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ColinChang.OssHelper&version=1.2.8
 
Install as a Cake Addin
#tool nuget:?package=ColinChang.OssHelper&version=1.2.8
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

OssHelper

Oss Helper for .Net Core, which provides STS, Policy Authentication, and common callback functions.

Functions

/// <summary>
/// 阿里云OSS STS授权
/// </summary>
/// <returns></returns>
Task<AssumeRoleResponse.AssumeRole_Credentials> GetStsAsync();

/// <summary>
/// 阿里云OSS Policy授权
/// </summary>
/// <returns></returns>
Task<dynamic> GetPolicyAsync(int category);

/// <summary>
/// OSS 通用回调
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Task<OssObject> CallbackAsync(HttpRequest request);

/// <summary>
/// 列举文件
/// </summary>
/// <param name="prefix">限定返回文件的Key必须以prefix作为前缀。如果把prefix设为某个文件夹名,则列举以此prefix开头的文件,即该文件夹下递归的所有文件和子文件夹。如果把prefix设为某个文件夹名,则列举以此prefix开头的文件,即该文件夹下递归的所有文件和子文件夹。</param>
/// <param name="marker">指定List操作需要从此文件开始</param>
/// <param name="maxKeys">指定返回Object的最大数。</param>
/// <param name="delimiter">对Object名字进行分组的字符。所有Object名字包含指定的前缀,第一次出现delimiter字符之间的Object作为一组元素</param>
/// <returns></returns>
Task<ObjectListing> ListObjectsAsync(string prefix = null, string marker = null,
 int? maxKeys = null, string delimiter = null);

/// <summary>
/// 流式下载(如果要下载的文件太大,或者一次性下载耗时太长,您可以通过流式下载,一次处理部分内容,直到完成文件的下载)
/// </summary>
/// <param name="objectName"></param>
/// <param name="filename">本地文件存储</param>
/// <returns></returns>
Task DownloadAsync(string objectName, string filename);

/// <summary>
/// 流式下载(如果要下载的文件太大,或者一次性下载耗时太长,您可以通过流式下载,一次处理部分内容,直到完成文件的下载)
/// </summary>
/// <param name="objectName"></param>
/// <returns></returns>
Task<Stream> DownloadAsync(string objectName);

/// <summary>
/// 上传对象
/// </summary>
/// <param name="filename">文件名</param>
/// <param name="objectType">对象类型. 0:Photo, 1:Video, 2:Application, 3:Other</param>
/// <param name="data">上传内容</param>
/// <returns></returns>
Task<PutObjectResult> UploadAsync(string filename, int objectType, byte[] data);

/// <summary>
/// 删除对象
/// </summary>
/// <param name="objectName"></param>
/// <returns></returns>
Task<DeleteObjectResult> DeleteObjectAsync(string objectName);

/// <summary>
/// 删除对象
/// </summary>
/// <param name="objectNames"></param>
/// <returns></returns>
Task<DeleteObjectsResult> DeleteObjectsAsync(IList<string> objectNames);

Sample

we just verify the mime type and size of the uploaded object in the Callback function. about how to use this, please check the Sample project.

be sure you've set your Access information in appsettings.json before running the sample.

Reference

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 netstandard2.1 is compatible. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ColinChang.OssHelper:

Package Downloads
ColinChang.OssHelper.MultiBucket

an extension for OssHelper to support multiple clients in applications.

ColinChang.OssDownloader

this is a downloader for aliyun oss resources.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.8 414 7/9/2024
1.2.7 891 5/11/2023
1.2.6 740 5/11/2023 1.2.6 is deprecated because it is no longer maintained.
1.2.5 2,937 6/7/2022
1.2.4 916 6/7/2022
1.2.3 1,900 5/12/2022
1.2.2 1,193 4/2/2021
1.2.1 737 3/15/2021
1.2.0 866 3/13/2021
1.1.1 649 12/8/2020
1.1.0 633 12/4/2020
1.0.0 640 11/25/2020

STS/Policy中补充BucketName字段