JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q935F
  • License MIT

convert byte lengths into a nice formatted string

Package Exports

  • bytelabel

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bytelabel) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

bytelabel Build Status

Convert byte lengths into a nice formatted string.

Installation

$ npm install bytelabel

Test:

$ npm test

Usage/API

bytelabel(number)

The only argument takes either a number or a parseable string (e.g. "100") assumes that this value is in bytes and returns the size more nicely formatted.

Examples:

var bytelabel = require('bytelabel');

// Parsed values

bytelabel(1234); // => '1234 B'
bytelabel(5789678); // => '5.52 MB'
bytelabel('100'); // => '100 B'

// Errors

bytelabel(true)); // => 'error';
bytelabel(blah)); // => 'error';
bytelabel('a string')); // => 'error';

License

MIT