https://github.com/MrSquirrely/Squirrel-Sizer
A simple and easy to use file sizing utility
https://github.com/MrSquirrely/Squirrel-Sizer
csharp dotnet-standard file-sizer filesize simple
Last synced: 3 months ago
JSON representation
A simple and easy to use file sizing utility
- Host: GitHub
- URL: https://github.com/MrSquirrely/Squirrel-Sizer
- Owner: MrSquirrely
- License: lgpl-3.0
- Created: 2019-07-03T21:03:38.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-03T13:03:05.000Z (over 1 year ago)
- Last Synced: 2025-01-28T17:17:39.080Z (3 months ago)
- Topics: csharp, dotnet-standard, file-sizer, filesize, simple
- Language: C#
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Squirrel-Sizer
This is a simple file sizing library.Goto https://www.nuget.org/packages/SquirrelSizer/
To use it is simple.
### You give it a long number and it gives you a string with the size abbreviation suffix.
```c#
long number = 1234500;
Sizer.Suffix(number);
// This will output 1kb
```or
```c#
long number = 1234500;
Sizer.SuffixName(number);
// This will output 1 Kilobyte
```-------
### It will always give you a number with your string
### To stop it from giving you a number```c#
long number = 1234500;
Sizer.Suffix(number, includeNumber: false)
// This will output kb
```### You have to include the "includeNumber:" part, this is cause of the way I implemented it.
### I might change this later.-------
### To change how many decimal places to use it's easy as well
```c#
long number = 1234500;
Sizer.SuffixName(number, 4)
// This will output 1.1773 Kilobyte
``````c#
long number = 1234500;
Sizer.SuffixName(number, 4, false)
// This will output Kilobyte
```-------
### To use this with files is even as easy.```c#
Sizer.Suffix("C:\\Path\\To\\File\\file.txt");
// This will output the converted size of the file.
```or
```c#
Sizer.SuffixName("C:\\Path\\To\\File\\file.txt");
// This will output the converted size of the file.
```-------
### You can even get the complete size of multiple files
```c#
List files = new List() {
"C:\\Path\\To\\File\\file1.txt",
"C:\\Path\\To\\File\\file2.txt",
"C:\\Path\\To\\File\\file3.txt"
};
Sizer.AllSuffix(files);
// This will output the size of all the files in the list
```or
```c#
List files = new List() {
"C:\\Path\\To\\File\\file1.txt",
"C:\\Path\\To\\File\\file2.txt",
"C:\\Path\\To\\File\\file3.txt"
};
Sizer.AllSuffixName(files);
// This will output the size of all the files in the list
```-------