angular-pretty-size
Angular library that converts bytes to a human readable string. 1189 to 1.2KB.
Get Started
Installation
You can install this package locally with npm.
# To get the latest stable version and update package.json file: npm install angular-pretty-size --save# or yarn add angular-pretty-size
Usage
After installing the library, import it in you module.
; // using default options
Use it in html.
//directive//pipe{{1000|nxtPrettySize}}//or
Use service in your component.
;
Configuration
PrettySizeOptions
Optionaly, PrettySizeModule can be configured by passing PrettySizeOptions to the forRoot
method of PrettySizeModule
.
PrettySizeOptions default options is.
Make sure the units, divisor and scale is not empty.
As you can see, I added a space before each unit. 1024 bytes displayed as 10 KiB
.
;