2023-04-10 15:36:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2017-12-15 21:39:18 +00:00
|
|
|
import Helper from '@ember/component/helper';
|
2021-03-26 04:55:55 +00:00
|
|
|
import { formatBytes } from 'nomad-ui/utils/units';
|
2017-10-17 01:45:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Bytes Formatter
|
|
|
|
*
|
2021-03-27 00:02:54 +00:00
|
|
|
* Usage: {{format-bytes bytes start="KiB"}}
|
2017-10-17 01:45:07 +00:00
|
|
|
*
|
|
|
|
* Outputs the bytes reduced to the largest supported unit size for which
|
|
|
|
* bytes is larger than one.
|
|
|
|
*/
|
2021-03-27 00:02:54 +00:00
|
|
|
function formatBytesHelper([bytes], { start }) {
|
|
|
|
return formatBytes(bytes, start);
|
2017-10-17 01:45:07 +00:00
|
|
|
}
|
|
|
|
|
2021-03-26 04:55:55 +00:00
|
|
|
export default Helper.helper(formatBytesHelper);
|