Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    bytelabelpublic

    bytelabel Build Status js-standard-style

    Convert byte lengths into a nice formatted string.

    Installation

    $ npm install bytelabel
    

    Test:

    $ npm test
    

    Usage/API

    bytelabel(number)

    The only argument takes a number assumes that this value is in bytes and returns the size more nicely formatted.

    Examples:

    var bytelabel = require('bytelabel')
     
    // Parsed values
     
    bytelabel(123)      // => '123 B'
    bytelabel(4398)     // => '4.29 KB'
    bytelabel(22323445) // => '21.28 MB'
     
    // Rounding
     
    bytelabel(123, {round: true})       // => '123 B'
    bytelabel(4398, {round: true})      // => '4 KB'
    bytelabel(22323445, {round: true})  // => '21 MB'
     

    License

    MIT

    install

    npm i bytelabel

    Downloadsweekly downloads

    11

    version

    2.0.2

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar