Bitzsoft.Integrations.CloudDrive 1.0.0-alpha.10

This is a prerelease version of Bitzsoft.Integrations.CloudDrive.
dotnet add package Bitzsoft.Integrations.CloudDrive --version 1.0.0-alpha.10
                    
NuGet\Install-Package Bitzsoft.Integrations.CloudDrive -Version 1.0.0-alpha.10
                    
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="Bitzsoft.Integrations.CloudDrive" Version="1.0.0-alpha.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.CloudDrive" Version="1.0.0-alpha.10" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.CloudDrive" />
                    
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 Bitzsoft.Integrations.CloudDrive --version 1.0.0-alpha.10
                    
#r "nuget: Bitzsoft.Integrations.CloudDrive, 1.0.0-alpha.10"
                    
#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 Bitzsoft.Integrations.CloudDrive@1.0.0-alpha.10
                    
#: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=Bitzsoft.Integrations.CloudDrive&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.CloudDrive&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.CloudDrive

企业网盘服务抽象层 -- 统一接口定义与基础模型。

功能特性

  • 统一接口 ICloudDriveProvider,屏蔽各企业网盘供应商 API 差异
  • 全场景覆盖:文件操作、文件夹管理、共享权限、版本管理、搜索等核心能力
  • 不可变模型:所有模型属性使用 init 访问器,线程安全
  • 统一异常CloudDriveException 携带供应商名称、错误码与原始消息
  • 能力声明:受限于供应商 API,部分操作抛出 NotSupportedException,调用前需确认能力
  • 独立模块:与 FileStorage(对象存储)模块解耦,按需组合使用

与 FileStorage 的区别

维度 FileStorage(对象存储) CloudDrive(企业网盘)
存储模型 Bucket + Key(扁平) 文件夹树(层级)
权限模型 AccessKey + ACL 用户/组/角色权限
协作能力 共享链接、在线编辑、版本对比
认证方式 AccessKey/Secret OAuth 2.0 / 企业账号

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.CloudDrive

PackageReference

<PackageReference Include="Bitzsoft.Integrations.CloudDrive" Version="1.0.0" />

本包为抽象层,不含任何供应商实现。请按需安装下方「相关包」中的具体供应商包。

核心接口

ICloudDriveProvider 定义了企业网盘的全部能力,所有属性与方法按场景分组。

文件操作

方法 说明
UploadAsync 上传文件(返回上传结果)
DownloadAsync 下载文件(返回内容流)
DeleteFileAsync 删除文件
MoveFileAsync 移动文件(支持重命名)
CopyFileAsync 复制文件(支持重命名)
GetFileInfoAsync 获取文件元数据

文件夹操作

方法 说明
ListFilesAsync 列出文件夹内容(支持分页)
CreateFolderAsync 创建文件夹
DeleteFolderAsync 删除文件夹

搜索

方法 说明
SearchAsync 搜索文件(支持关键词/类型/扩展名筛选、排序、分页)

共享与权限

方法 说明
CreateShareLinkAsync 创建共享链接
DeleteShareLinkAsync 删除共享链接
GetPermissionsAsync 获取权限列表
SetPermissionAsync 设置权限
DeletePermissionAsync 删除权限

版本管理

方法 说明
ListVersionsAsync 获取版本列表
DownloadVersionAsync 下载指定版本
RestoreVersionAsync 恢复到指定版本

核心类型一览

接口与异常

类型 说明
ICloudDriveProvider 企业网盘服务统一抽象接口(18 个方法 + ProviderName
CloudDriveException 统一异常(ProviderName / ErrorCode / ProviderMessage

模型

类型 说明
DriveFileInfo 文件或文件夹信息(Id / Name / Type / Size / DownloadUrl 等)
ListFilesResult 文件列表结果(Items / NextPageToken / TotalCount)
UploadFileRequest 上传请求(FolderId / FileName / Content / ContentLength / ConflictBehavior)
UploadFileResult 上传结果(FileInfo)
CreateFolderRequest 创建文件夹请求(ParentFolderId / Name / ConflictBehavior)
SearchFilesRequest 搜索请求(Keyword / FolderId / FileType / Extension / SortBy / 分页)
CreateShareLinkRequest 创建共享链接请求(FileId / AccessLevel / Password / ExpireTime)
DriveShareLink 共享链接信息(Url / AccessLevel / HasPassword / ExpireTime)
DrivePermission 权限信息(Role / GrantedTo / CanDownload / CanPreview)
DriveFileVersion 文件版本信息(VersionId / VersionLabel / ModifiedBy / Size)

枚举

类型 说明
DriveFileType 文件类型(File / Folder
ShareLinkAccessLevel 共享链接访问级别(View / Edit / Upload / Download
PermissionRole 权限角色(Reader / Writer / Owner
FileSortOrder 排序方式(Name / ModifiedTime / Size

注册服务

本抽象层不提供 DI 扩展方法。由各供应商实现包注册 ICloudDriveProvider,例如:

// 安装供应商包(如 Nutstore)后调用对应扩展方法
services.AddBitzsoftNutstoreCloudDrive(configuration, "CloudDrive:Nutstore");

使用示例

注入 ICloudDriveProvider 即可使用,无需关心具体供应商。

using Bitzsoft.Integrations.CloudDrive.Interfaces;
using Bitzsoft.Integrations.CloudDrive.Models;

public class MyService
{
    private readonly ICloudDriveProvider _drive;

    public MyService(ICloudDriveProvider drive) => _drive = drive;

    public async Task UploadAndListAsync()
    {
        // 上传文件
        await using var stream = File.OpenRead("report.pdf");
        var uploadResult = await _drive.UploadAsync(new UploadFileRequest
        {
            FolderId = "root",
            FileName = "report.pdf",
            Content = stream,
            ContentType = "application/pdf"
        });

        // 列出文件夹内容
        var files = await _drive.ListFilesAsync("root");
        foreach (var file in files.Items)
        {
            Console.WriteLine($"{file.Name} ({file.Size} bytes)");
        }

        // 下载文件
        var downloadStream = await _drive.DownloadAsync(uploadResult.FileInfo.Id);

        // 搜索文件
        var results = await _drive.SearchAsync(new SearchFilesRequest
        {
            Keyword = "report",
            FileType = DriveFileType.File
        });
    }
}

请求审计

出站请求记录能力由各供应商实现包内置(依赖 Bitzsoft.Integrations.RequestLogging),抽象层本身不发起 HTTP 请求。具体用法见各供应商包 README。

依赖

说明
Bitzsoft.Integrations.Compatibility 基础工具库

相关包

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on Bitzsoft.Integrations.CloudDrive:

Package Downloads
Bitzsoft.Integrations.CloudDrive.Microsoft365

Microsoft 365 企业网盘服务实现

Bitzsoft.Integrations.CloudDrive.Baidu

百度企业网盘服务实现

Bitzsoft.Integrations.CloudDrive.Aliyun

阿里云网盘与相册服务实现

Bitzsoft.Integrations.CloudDrive.Gokuai

够快云库企业网盘服务实现

Bitzsoft.Integrations.CloudDrive.Nutstore

坚果云企业网盘服务实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.10 39 7/26/2026
1.0.0-alpha.9 89 7/12/2026
1.0.0-alpha.8 326 7/1/2026
1.0.0-alpha.7 100 6/16/2026
1.0.0-alpha.6 98 6/16/2026
1.0.0-alpha.5 99 6/14/2026
1.0.0-alpha.4 81 7/1/2026
1.0.0-alpha.3 92 6/7/2026