Numbers
byteSize
Nonnegative finite byte count.
Use it in your component
Standalone component
import { Component } from '@angular/core';
import { ByteSizePipe } from 'extra-pipe';
@Component({
standalone: true,
imports: [ByteSizePipe],
template: `{{ 1048576 | byteSize: {base: 1024}: 'fr' }}`,
})
export class ExampleComponent {
}
Template
{{ 1048576 | byteSize: {base: 1024}: 'fr' }}
Try it live.
The output below runs the packed library. Edit data, not code.
Use double quotes for text, or a number, array, object or null.
Ordered parameters: options. Locale is controlled separately.
Applied to the live output.
Live template data
readonly value = 1048576;
readonly parameter0 = {"base":1024,"maximumFractionDigits":2} as const;
{{ value | byteSize: parameter0: "en-US" }}
Rendered output
1 MiB