All Projects → md-frank → File Service

md-frank / File Service

Licence: gpl-3.0
ASP.NET Core based universal file server

Projects that are alternatives of or similar to File Service

Netcore Boilerplate
Boilerplate of API in .NET Core 3.1
Stars: ✭ 166 (-27.19%)
Mutual labels:  asp-net-core
Aspnetcoremultipleproject
ASP.NET Core API EF Core and Swagger
Stars: ✭ 189 (-17.11%)
Mutual labels:  asp-net-core
Magic
Create your .Net Core/Angular/Database CRUD Web apps by simply clicking a button
Stars: ✭ 214 (-6.14%)
Mutual labels:  asp-net-core
Angular 7 Project With Asp.net Core Apis
Angular 7 Project with ASP.NET CORE APIS | Angular Project
Stars: ✭ 174 (-23.68%)
Mutual labels:  asp-net-core
Aspnetcorelocalization
Localization.SqlLocalizer & ASP.NET Core MVC Localization Examples
Stars: ✭ 183 (-19.74%)
Mutual labels:  asp-net-core
Anclafs
ASP.NET Core Library and Framework Support
Stars: ✭ 192 (-15.79%)
Mutual labels:  asp-net-core
Storedprocedureefcore
Entity Framework Core extension to execute stored procedures
Stars: ✭ 164 (-28.07%)
Mutual labels:  asp-net-core
Aspnetcore2jwtauthentication
Jwt Authentication without ASP.NET Core Identity
Stars: ✭ 218 (-4.39%)
Mutual labels:  asp-net-core
Hotchocolate
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
Stars: ✭ 3,009 (+1219.74%)
Mutual labels:  asp-net-core
Grapefruit.vucore
A front-background project using ASP.NET Core WebApi and Vue.js
Stars: ✭ 210 (-7.89%)
Mutual labels:  asp-net-core
Dynamicrolebasedauthorizationnetcore
Dynamic Role-Based Authorization in ASP.NET Core MVC 2.1, 3.1 and 5.0
Stars: ✭ 174 (-23.68%)
Mutual labels:  asp-net-core
Jwtsimpleserver
A lightweight, dynamic jwt server for ASP.NET Core
Stars: ✭ 181 (-20.61%)
Mutual labels:  asp-net-core
Onion Architecture Asp.net Core
WhiteApp API solution template which is built on Onion Architecture with all essential feature using .NET 5!
Stars: ✭ 196 (-14.04%)
Mutual labels:  asp-net-core
Lyniconanc
Lynicon CMS for ASP.Net Core for .Net Standard 2.0/2.1 and .Net 4.6.1/4.6
Stars: ✭ 173 (-24.12%)
Mutual labels:  asp-net-core
Signalr Client Swift
Swift SignalR Client for Asp.Net Core SignalR server
Stars: ✭ 213 (-6.58%)
Mutual labels:  asp-net-core
Netcorecms
NetCoreCMS is a modular theme supported Content Management System developed using ASP.Net Core 2.0 MVC. Which is also usable as web application framework. This project is still under development. Please do not use before it's first release.
Stars: ✭ 165 (-27.63%)
Mutual labels:  asp-net-core
Jquerydatatablesserverside
Asp.Net Core Server Side for Jquery DataTables Multiple Column Filtering and Sorting with Pagination and Excel Export
Stars: ✭ 191 (-16.23%)
Mutual labels:  asp-net-core
Aspnetcore.template
ASP.NET core mvc project template for real world applications
Stars: ✭ 226 (-0.88%)
Mutual labels:  asp-net-core
Coolcat
A sample about how to create a dynamic plugins mechanism with ASP.NET Core Mvc at runtime. This sample is based on .NET Core 3.1 and .NET 5
Stars: ✭ 216 (-5.26%)
Mutual labels:  asp-net-core
Home
Welcome to .NET "Presentations in a Box." We have a listing of workshops and presentations YOU can use AND contribute to! Remix and share, and present at Meetups, User Groups, CodeCamps, or Conferences! Not familiar with .NET? Download open source .NET Core for any OS at http://dot.net or try it in your browser at http://try.dot.net now!
Stars: ✭ 204 (-10.53%)
Mutual labels:  asp-net-core

file-service

一个基于ASP.NET Core的可伸缩、通用的文件服务器。
通常后端项目可能会有头像、图片、音频、视频等上传/下载需求,这些需求都可以抽象为文件服务。

功能特点

  • 支持Linux(推荐)、Windows
  • 可伸缩式架构,支持部署1-N台文件服务器
  • RESTful架构的API接口,支持多语言客户端
  • 支持文件秒传、断点续传、远程拉取上传
  • 支持为用户指定磁盘空间配额
  • 支持自定义文件处理器

系统架构

Scheme

  • 文件的上传/下载通常由客户端直接与文件服务器交互,上传时需要提供代表用户身份token(由业务服务器生成),成功后会返回文件根地址。
  • 也可以直接由业务服务器上传返回文件根地址给客户端。
  • 源码中包含基于.Net Standard的服务端SDK,可以生成token、上传文件等
  • 源码中包含基于.Net Standard的客户端SDK,可以上传/下载文件等

后端使用

配置业务服务器

//Startup.cs代码片段
public void ConfigureServices(IServiceCollection services)
{
    //....
    services.AddFileService(opts =>
    {
        opts.Host = "fs.mondol.info"; //文件服务器域名
        opts.AppSecret = "xxxxxx"; //加密密钥,需要与文件服务器相同
    });
}

生成访问令牌

IFileServiceManager fileSvceMgr; //此实例可通过DI框架获得
//根据业务规定其意义,例如:1-代表管理员,2-代表用户
var ownerType = 2;
var ownerId = 2; //如果ownerType=2,则为用户ID
var validTime = TimeSpan.FromDays(2); //token有效期
var ownerToken = fileSvceMgr.GenerateOwnerTokenString(ownerType, ownerId, validTime);

前端使用

文件上传

IFileServiceClient fileClient; //此实例可通过DI框架获得
var ownerToken = "业务服务器返回的token";
var periodMinute = 0; //有效期,0不过期
var updResult = await fileClient.UploadAsync(ownerToken, "文件路径", periodMinute);
var url = updResult.Data.Url; //得到文件根地址

URL格式说明

完整URL格式是这样的:https://domain.com/{fileToken}/{handler}/{modifier}
fileToken:是本次上传文件的唯一标识符
handler:文件处理器,可以是image(图片处理器)、video(视频处理器)、raw(返回原文件)等
modifier:【可选】文件处理器参数,例如,image处理器,可以指定128x128_png

文件上传成功后返回的文件根地址(updResult.Data.Url)就是截至到https://domain.com/{fileToken} URL后面部分由客户端自己根据需求拼接

下面举例说明:

下载原文件
文件根地址/raw,例如:
http://file.domain.com/files/1iYQTU7fEUgaa~URSVwaCqQKFml_IAAAAAgAAAAbhmsFjiUUQwCPn2ngI1QcvsSp0AA/raw

下载128x128大小的缩略图(原文件是图像)
文件根地址/image/128x128,例如: http://file.domain.com/files/1iYQTU7fEUgaa~URSVwaCqQKFml_IAAAAAgAAAAbhmsFjiUUQwCPn2ngI1QcvsSp0AA/image/128x128

下载128宽,高等比缩放的缩略图(原文件是图像)
文件根地址/image/128x,例如: http://file.domain.com/files/1iYQTU7fEUgaa~URSVwaCqQKFml_IAAAAAgAAAAbhmsFjiUUQwCPn2ngI1QcvsSp0AA/image/128x

原图是JPG格式,下载png格式的图像
文件根地址/image/raw_png,例如: http://file.domain.com/files/1iYQTU7fEUgaa~URSVwaCqQKFml_IAAAAAgAAAAbhmsFjiUUQwCPn2ngI1QcvsSp0AA/image/raw_png

原图是JPG格式,下载png格式的128x128大小的缩略像
文件根地址/image/128x128_png,例如: http://file.domain.com/files/1iYQTU7fEUgaa~URSVwaCqQKFml_IAAAAAgAAAAbhmsFjiUUQwCPn2ngI1QcvsSp0AA/image/128x128_png

联系方式

Email: [email protected]
cnblogs: http://mondol.cnblogs.com

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].