D7.Core.Minio
1.0.0
dotnet add package D7.Core.Minio --version 1.0.0
NuGet\Install-Package D7.Core.Minio -Version 1.0.0
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="D7.Core.Minio" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add D7.Core.Minio --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: D7.Core.Minio, 1.0.0"
#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.
// Install D7.Core.Minio as a Cake Addin #addin nuget:?package=D7.Core.Minio&version=1.0.0 // Install D7.Core.Minio as a Cake Tool #tool nuget:?package=D7.Core.Minio&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Sử dụng nó trong controllers như sau:
-- Cấu hình---------------- { "MinioConfig": { "Endpoint": "play.min.io", "AccessKey": "Q3AM3UQ867SPQQA43P2F", "SecretKey": "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", "UseSSL": true } }
-- End ----------------
[ApiController]
[Route("api/[controller]")]
public class FileController : ControllerBase
{
private readonly MinioHelpers _minioHelpers;
private const string BucketName = "your-bucket-name";
public FileController(MinioHelpers minioHelpers)
{
_minioHelpers = minioHelpers;
}
[HttpPost("upload")]
public async Task<IActionResult> UploadFile(IFormFile file)
{
try
{
string fileName = await _minioHelpers.UploadFileAsync(file, BucketName);
return Ok(new { FileName = fileName });
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpGet("download/{fileName}")]
public async Task<IActionResult> DownloadFile(string fileName)
{
try
{
var (fileStream, contentType, name) = await _minioHelpers.DownloadFileAsync(fileName, BucketName);
return File(fileStream, contentType, name);
}
catch (Exception ex)
{
return NotFound(ex.Message);
}
}
[HttpDelete("delete/{fileName}")]
public async Task<IActionResult> DeleteFile(string fileName)
{
try
{
await _minioHelpers.DeleteFileAsync(fileName, BucketName);
return Ok();
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.AspNetCore.Http.Features (>= 2.2.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Minio (>= 6.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 78 | 10/27/2024 |