byte-parser
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

byte-parser

Parse byte string to byte number, e.g. 1.2 Kb -> 1228.8, Kb, Mb, Gb, Tb, Pb, Eb, Zb, Yb supported.

npm Version Build Status npm npm License

Install

$ npm i --save-dev byte-parser

Usage

import parse from 'byte-parser';
 
parse('100');               // 100
parse('10.1 b');            // 10.1
parse('10.1 KB');           // 10.1 * 1024
parse('10.1 kb', 1000);     // 10.1 * 1000
parse('1.2 mb');            // 1.2 * 1024 * 1024
parse('1.2 Gb');            // 1.2 * 1024 * 1024 * 1024
parse('1.2 G');             // 1.2 * 1024 * 1024 * 1024

License

MIT@hustcc.

Package Sidebar

Install

npm i byte-parser

Weekly Downloads

383

Version

1.0.0

License

MIT

Unpacked Size

3.81 kB

Total Files

5

Last publish

Collaborators

  • atool