1.1.2 • Published 1 year ago
@d10f/digital v1.1.2
A parser that converts strings of digital data storage units into byte representation. Currently supported magnitudes are: bytes, kilobytes, megabytes, gigabytes, terabytes and petabytes.
Usage:
Import it into your project using CommonJS or ESM modules:
import parse from '@d10f/digital';
// const parse = require('@d10f/digital');
parse('12.5 Gigabytes'); // 12500000000It also supports binary system for better precision:
parse('12.5 Gibibytes'); // 1342177800For convenience you can provide the shorthand for each unit of measurement (case insensitive):
parse('12.5 Gb');
parse('12.5 Gib');TODO:
- Support for
exabytes,zettabytesandyottabytes(small amounts only). - Support for BigInt returns
exabytes,zettabytesandyottabytes.