vue-filter-pretty-bytes
v0.1.6
Published
Vue 2 Filter to prettify bytes
Downloads
2,302
Readme
vue-filter-pretty-bytes
Vue 2 Filter to prettify bytes
Install
Available through npm as vue-filter-pretty-bytes
, or include as an inline script.
import Vue from 'vue'
import vueFilterPrettyBytes from 'vue-filter-pretty-bytes'
Vue.use(vueFilterPrettyBytes)
or
Vue.use(require('vue-filter-pretty-bytes'))
Usage
{{ 15364878 | prettyBytes }}
Return: 15.36 MB
everywhere like methods, etc...
this.$options.filters.prettyBytes(15364878)
Options
Decimals and KiB
Decimals - Integer
{{ 15364878 | prettyBytes(1) }}
Return: 15.4 MB
KiB - Boolean
{{ 15364878 | prettyBytes(1, true) }}
Return: 14.7 MiB
Max Unit
Normal
{{ 15364878 | prettyBytes(1, false, 'KB') }}
Options: 'Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB', 'BB'
Return: 15364.9 KB
KiB
{{ 15364878 | prettyBytes(1, true, 'KiB') }}
Options: 'Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB', 'BiB'
Return: 15004.8 KiB