All Projects → LeopoldArkham → humansize

LeopoldArkham / humansize

Licence: other
Humansize - A flexible crate for humanizing file sizes

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to humansize

safe-svg
Enable SVG uploads and sanitize them to stop XML/SVG vulnerabilities in your WordPress website.
Stars: ✭ 129 (+303.13%)
Mutual labels:  file
read-yaml
Very thin wrapper around js-yaml for directly reading in YAML files.
Stars: ✭ 25 (-21.87%)
Mutual labels:  file
rust-magic
Rust high level bindings crate for the `libmagic` C library
Stars: ✭ 22 (-31.25%)
Mutual labels:  file
transfer-sh
Node.js CLI tool for easy file sharing using Transfer.sh
Stars: ✭ 24 (-25%)
Mutual labels:  file
file-icon-cli
Get the icon of a file or app as a PNG image (macOS)
Stars: ✭ 73 (+128.13%)
Mutual labels:  file
lrkFM
Awesome, (ad) free, open source file manager for Android
Stars: ✭ 44 (+37.5%)
Mutual labels:  file
helm-fzf
Fzf using Helm as a front end
Stars: ✭ 16 (-50%)
Mutual labels:  file
fuckwinfsdel
Solve Windows can't delete long paths file's bug.
Stars: ✭ 24 (-25%)
Mutual labels:  file
SimpleStorage
💾 Simplify Android Storage Access Framework for file management across API levels.
Stars: ✭ 498 (+1456.25%)
Mutual labels:  file
cheap-watch
If it works, why use something else? // Mirror of https://git.chor.date/Conduitry/cheap-watch
Stars: ✭ 64 (+100%)
Mutual labels:  file
gosearch
a fast, real-time file searching program for linux
Stars: ✭ 68 (+112.5%)
Mutual labels:  file
file-vault
A Laravel package for encrypting and decrypting files of any size
Stars: ✭ 152 (+375%)
Mutual labels:  file
php-mime-detector
Detect a file's mime type using magic numbers.
Stars: ✭ 20 (-37.5%)
Mutual labels:  file
inplace
In-place file processing in Python
Stars: ✭ 21 (-34.37%)
Mutual labels:  file
RecordParser
Zero Allocation Writer/Reader Parser for .NET Core
Stars: ✭ 155 (+384.38%)
Mutual labels:  file
file-upload-with-preview
🖼 Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.
Stars: ✭ 406 (+1168.75%)
Mutual labels:  file
cemu-smmdb
No description or website provided.
Stars: ✭ 56 (+75%)
Mutual labels:  file
Voila
Voila is a domain-specific language launched through CLI tool for operating with files and directories in massive amounts in a fast & reliable way.
Stars: ✭ 78 (+143.75%)
Mutual labels:  file
watcher
The file system watcher that strives for perfection, with no native dependencies and optional rename detection support.
Stars: ✭ 37 (+15.63%)
Mutual labels:  file
lib-preferences
Lib-Preferences is a library for easy storing simple data to a Preferences.properties file in a Java(FX) & Maven desktop application.
Stars: ✭ 12 (-62.5%)
Mutual labels:  file

Humansize travis badge

Documentation

Features

Humansize lets you easily represent file sizes in a human-friendly format. You can specify your own formatting style or pick among the three defaults provided by the library:

  • Decimal (Multiples of 1000, KB units)
  • Binary (Multiples of 1024, KiB units)
  • Windows/Conventional (Multiples of 1024, KB units)

How to use it

Cargo.Toml:

[dependencies]
humansize = "1.1.1"

Simply import the FileSize trait and the options module and call the file_size method on any positive integer, using one of the three standards provided by the options module.

extern crate humansize;
use humansize::{FileSize, file_size_opts as options};

fn main() {
	let size = 1000;
	println!("Size is {}", size.file_size(options::DECIMAL).unwrap());

	println!("Size is {}", size.file_size(options::BINARY).unwrap());

	println!("Size is {}", size.file_size(options::CONVENTIONAL).unwrap());
}

If you wish to customize the way sizes are displayed, you may create your own custom FileSizeOpts struct and pass that to the method. See the custom_options.rs file in the example folder.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in humansize by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

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