Skip to content

stkossman/human_file_size

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Human File Size

Gem Version

Human File Size is a simple Gem for formatting file sizes into a human-readable format.

Installation

Add this line to your application's Gemfile:

gem 'human_file_size'

And then execute:

bundle install

Or install it yourself as:

gem install human_file_size

Usage

require 'human_file_size'

HumanFileSize.format(100)          # => "100.00 B"
HumanFileSize.format(1024)         # => "1.00 KB"
HumanFileSize.format(1536)         # => "1.50 KB"
HumanFileSize.format(1048576)      # => "1.00 MB"
HumanFileSize.format(2621440, precision: 1) # => "2.5 MB"
HumanFileSize.format(1572864576)   # => "1.50 GB"

License

This Gem is distributed under the MIT License. See the LICENSE.txt fire for details

Author

About

Human File Size is a simple Gem for formatting file sizes into a human-readable format.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages