DotNetOpen.FileService 3.0.0

A library to manage files in an organized, efficient and simple manner.

Install-Package DotNetOpen.FileService -Version 3.0.0
dotnet add package DotNetOpen.FileService --version 3.0.0
<PackageReference Include="DotNetOpen.FileService" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetOpen.FileService --version 3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

DotNetOpen.FileService

A library to manage files in an organized, efficient and simple manner.

Classes

FileService

<p>The default <a href="https://github.com/DaniAsh551/DotNetOpen/blob/master/FileService/DotNetOpen.FileService.Abstractions/Interfaces/IFileService.cs">IFileService</a> implementation which is provided. Requires an instance of <a href="https://github.com/DaniAsh551/DotNetOpen/blob/master/FileService/DotNetOpen.FileService.Abstractions/Interfaces/IFileServiceConfig.cs">IFileServiceConfig</a> in order to work.</p>

FileServiceConfig

<p>The default <a href="https://github.com/DaniAsh551/DotNetOpen/blob/master/FileService/DotNetOpen.FileService.Abstractions/Interfaces/IFileServiceConfig.cs">IFileServiceConfig</a> implementation provided.

FileMetaData

<p>The default <a href="https://github.com/DaniAsh551/DotNetOpen/blob/master/FileService/DotNetOpen.FileService.Abstractions/Interfaces/IFileMetaData.cs">IFileMetaData</a> implementation provided.

Enums

FileSizeUnit

<p>This Enum is not actually physically included in this package, but is rather inherited from the <a href="https://github.com/DaniAsh551/DotNetOpen/tree/master/FileService/DotNetOpen.FileService.Abstractions">DotNetOpen.FileService.Abstractions</a> and defines the units of size used throughout the whole package.

HOWTO

<p>In order to use the functionalities provided within the library, you must create or load an instance of IFileServiceConfig</p>

<pre><code class='language-cs'>
var allowedExtensions = new string[] {"zip", "mp3", "png", "jpg", "gif"};
var config = new FileServiceConfig(
stream => "application/octet-stream",
28,
FileSizeUnit.MB,
Path.Combine(Environment.CurrentDirectory, "Files"),
allowedExtensions);
var fileService = new FileService(config);
</code></pre>

<p>Now, imagining that you have a zip file in a stream named 'stream' in order to save a stream into a file</p>
<pre><code class='language-cs'>
var fileMetaData = await fileService.CreateAsync("thefile.zip", "zip", stream);
</code></pre>

<p>This gives you a variable of type 'IFileMetaData' which contains the basic information of the file which we just saved.</p>
<p>Now imagining that you want to get the data of the newly created file into a stream named 'strm'</p>
<pre><code class='language-cs'>
var metaData = fileService.GetFile("thefile.zip", "zip");
</code></pre>

DotNetOpen.FileService

A library to manage files in an organized, efficient and simple manner.

Classes

FileService

<p>The default <a href="https://github.com/DaniAsh551/DotNetOpen/blob/master/FileService/DotNetOpen.FileService.Abstractions/Interfaces/IFileService.cs">IFileService</a> implementation which is provided. Requires an instance of <a href="https://github.com/DaniAsh551/DotNetOpen/blob/master/FileService/DotNetOpen.FileService.Abstractions/Interfaces/IFileServiceConfig.cs">IFileServiceConfig</a> in order to work.</p>

FileServiceConfig

<p>The default <a href="https://github.com/DaniAsh551/DotNetOpen/blob/master/FileService/DotNetOpen.FileService.Abstractions/Interfaces/IFileServiceConfig.cs">IFileServiceConfig</a> implementation provided.

FileMetaData

<p>The default <a href="https://github.com/DaniAsh551/DotNetOpen/blob/master/FileService/DotNetOpen.FileService.Abstractions/Interfaces/IFileMetaData.cs">IFileMetaData</a> implementation provided.

Enums

FileSizeUnit

<p>This Enum is not actually physically included in this package, but is rather inherited from the <a href="https://github.com/DaniAsh551/DotNetOpen/tree/master/FileService/DotNetOpen.FileService.Abstractions">DotNetOpen.FileService.Abstractions</a> and defines the units of size used throughout the whole package.

HOWTO

<p>In order to use the functionalities provided within the library, you must create or load an instance of IFileServiceConfig</p>

<pre><code class='language-cs'>
var allowedExtensions = new string[] {"zip", "mp3", "png", "jpg", "gif"};
var config = new FileServiceConfig(
stream => "application/octet-stream",
28,
FileSizeUnit.MB,
Path.Combine(Environment.CurrentDirectory, "Files"),
allowedExtensions);
var fileService = new FileService(config);
</code></pre>

<p>Now, imagining that you have a zip file in a stream named 'stream' in order to save a stream into a file</p>
<pre><code class='language-cs'>
var fileMetaData = await fileService.CreateAsync("thefile.zip", "zip", stream);
</code></pre>

<p>This gives you a variable of type 'IFileMetaData' which contains the basic information of the file which we just saved.</p>
<p>Now imagining that you want to get the data of the newly created file into a stream named 'strm'</p>
<pre><code class='language-cs'>
var metaData = fileService.GetFile("thefile.zip", "zip");
</code></pre>

Release Notes

Changelog v1.0.1
- Added new async methods
- Fixed FileSizeUnit calculation bug
- Create and Update now supports Streams

Changelog v2.0.0
- Fixed critical namespace issues
- Fixed unnecessary exception throwing

Changelog v3.0.0
- Fixed some more filesize related bugs
- Added rules, now custom rules for file acception can be added in the config

Version History

Version Downloads Last updated
3.0.0 79 3/7/2019
2.0.0 63 3/6/2019
1.0.0 68 2/19/2019