Skip to content

8️⃣ (130B) Parse byte string to byte number, e.g. 1.2 Kb -> 1228.8, Kb, Mb, Gb, Tb, Pb, Eb, Zb, Yb supported.

License

Notifications You must be signed in to change notification settings

hustcc/byte-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

8️⃣ (130B) Parse byte string to byte number, e.g. 1.2 Kb -> 1228.8, Kb, Mb, Gb, Tb, Pb, Eb, Zb, Yb supported.

Topics

Resources

License

Stars

Watchers

Forks