Socket
Book a DemoInstallSign in
Socket

numeric-filesize

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

numeric-filesize

1.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

💡 About

This adds methods to numeric class to returns bytes from filesize and reverse.

📥 Installation

Install the gem and add to the application's Gemfile by executing:

bundle add numeric-filesize

If bundler is not being used to manage dependencies, install the gem by executing:

gem install numeric-filesize

⌨️ Usage

In Ruby do:

require 'numeric/filesize'

Enjoy filesize in Ruby:

1.b    #=> 1
1.kb   #=> 1000
1.mb   #=> 1000_000
1.gb   #=> 1000_000_000
1.tb   #=> 1000_000_000_000
1.pb   #=> 1000_000_000_000_000
1.eb   #=> 1000_000_000_000_000_000
1.kib  #=> 1024
1.mib  #=> 1048_576
1.gib  #=> 1073_741_824
1.tib  #=> 1099_511_627_776
1.pib  #=> 1125_899_906_842_624
1.eib  #=> 1152_921_504_606_846_976

1.to_b                           #=> 1
1000.to_kb                       #=> 1
1000_000.to_mb                   #=> 1
1000_000_000.to_gb               #=> 1
1000_000_000_000.to_tb           #=> 1
1000_000_000_000_000.to_pb       #=> 1
1000_000_000_000_000_000.to_eb   #=> 1
1024.to_kib                      #=> 1
1048_576.to_mib                  #=> 1
1073_741_824.to_gib              #=> 1
1099_511_627_776.to_tib          #=> 1
1125_899_906_842_624.to_pib      #=> 1
1152_921_504_606_846_976.to_eib  #=> 1

💌 Credits

  • Nushell by it's contributors

FAQs

Package last updated on 17 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.