0.0
No commit activity in last 3 years
No release in over 3 years
Convert bytes to a human readable string: 1337 → 1.34 kB
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.11
~> 10.0
~> 3.0
 Project Readme

pretty-bytes-rb Build Status Gem Version

Convert bytes to a human readable string: 1337 → 1.34 kB

Useful for displaying file sizes for humans, Ported from sindresorhus/pretty-bytes

Installation

Add this line to your application's Gemfile:

gem 'pretty_bytes'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pretty_bytes

Usage

CLI

$ pretty-bytes help

  Usage
    $ pretty-bytes <number>

  Example
    $ pretty-bytes 1337
    1.34 kB

API

require "pretty_bytes"
pb = PrettyBytes.new

pb.convert(1337) # => 1.34 kB

License

MIT License