Skip to content

An Elixir library to make File Sizes human-readable

License

Notifications You must be signed in to change notification settings

arvidkahl/sizeable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sizeable

Module Version Hex Docs Total Download License Last Updated

An Elixir library to make file sizes human-readable.

Installation

The package can be installed as:

  1. Add :sizeable to your list of dependencies in mix.exs:

    def deps do
      [
        {:sizeable, "~> 1.0"}
      ]
    end
  2. Ensure sizeable is started before your application if you're using Elixir 1.3 or lower:

    def application do
      [
        applications: [:sizeable]
      ]
    end

Usage

Get file size for 1024 bytes

Sizeable.filesize(1024)
"1 KB"

Get bit-sized file size for 1024 bytes

Sizeable.filesize(1024, bits: true)
"8 Kb"

Get output format as list

Sizeable.filesize(1024, output: :list)
[1, "KB"]

Get output format as map

Sizeable.filesize(1024, output: :map)
%{result: 1, unit: "KB"}

Read Sizeable.filesize/2 for further usage details.

Copyright and License

Copyright (c) 2016 Arvid Kahl

This software is licensed under the MIT license.

About

An Elixir library to make File Sizes human-readable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages