diff --git a/nuget/nuget.md b/nuget/nuget.md new file mode 100644 index 0000000..6e058d7 --- /dev/null +++ b/nuget/nuget.md @@ -0,0 +1,29 @@ +# FileSizeFromBase64.NET + +A .NET Standard 2.1 project containing a single method to get file size from base64 string. The base64 string can contain MIME-type or not. Paddings are also supported in the decoding process, you can define whether the paddings rules should be applied or not. +## Usage + +```csharp +using FileSizeFromBase64.NET; + +// File hello-world.txt => Size = 13 Bytes, Content: Hello world ! +var base64String = "data:text/plain;base64,SGVsbG8gd29ybGQgIQ=="; + +var fileSize = FileSizeHelpers.GetFileSizeFromBase64String(base64String, true); + +var fileSizeInKB = FileSizeHelpers.GetFileSizeFromBase64String(base64String, true, UnitsOfMeasurement.KiloByte); + +var fileSizeInMB = FileSizeHelpers.GetFileSizeFromBase64String(base64String, true, UnitsOfMeasurement.MegaByte); +``` + +## Parameters + +| Parameter | Type | Description | Required | Default | +|:---------------------|:-------:|:-----------:|:--------:|:-------:| +| `base64String` | string | The base64 representation of the file. | Yes | | +| `applyPaddingsRules` | bool | [Base64 Padding](https://en.wikipedia.org/wiki/Base64#Output_padding) | No | `false` | +| `unitsOfMeasurement` | Enum | `Byte`, `KiloByte`, or `MegaByte` | No | `Byte` | + +## License + +MIT — see [LICENSE](https://github.com/lioncoding-oss/FileSizeFromBase64.NET/blob/main/LICENSE) diff --git a/src/FileSizeFromBase64.NET/FileSizeFromBase64.NET.csproj b/src/FileSizeFromBase64.NET/FileSizeFromBase64.NET.csproj index 4dd547a..903bddd 100644 --- a/src/FileSizeFromBase64.NET/FileSizeFromBase64.NET.csproj +++ b/src/FileSizeFromBase64.NET/FileSizeFromBase64.NET.csproj @@ -7,13 +7,14 @@ true Kodjo Laurent Egbakou Get file size from base64 string + nuget.md https://github.com/lioncoding-oss/FileSizeFromBase64.NET https://github.com/lioncoding-oss/FileSizeFromBase64.NET logo.png 2.0.1 See: https://github.com/lioncoding-oss/FileSizeFromBase64.NET FileSize, Base64, Paddings, MIME-type - Copyright 2022 + Copyright 2026 MIT en @@ -32,6 +33,7 @@ +