Skip to content

Foundatio.Aliyun

Foundatio provides Alibaba Cloud OSS file storage implementation. View source on GitHub →

Overview

ImplementationInterfacePackage
AliyunFileStorageIFileStorageFoundatio.Aliyun

Installation

bash
dotnet add package Foundatio.Aliyun

Usage

csharp
using Foundatio.Storage;

var storage = new AliyunFileStorage(o =>
    o.ConnectionString = connectionString);

await storage.SaveFileAsync("documents/report.pdf", pdfStream);
var stream = await storage.GetFileStreamAsync("documents/report.pdf");

Configuration

Connection String (required):

csharp
var storage = new AliyunFileStorage(o =>
{
    o.ConnectionString = "endpoint=oss-cn-hangzhou.aliyuncs.com;accessKeyId=xxx;accessKeySecret=yyy;bucket=my-bucket";
});

For additional options including LoggerFactory, Serializer, TimeProvider, and ResiliencePolicyProvider, see the AliyunFileStorageOptions source.

Next Steps

Released under the Apache 2.0 License.