← All pipes
Numbers

fileSize

The original fixed-megabyte formatter.

Use it in your component

Standalone component
import { Component } from '@angular/core';
import { FileSizePipe } from 'extra-pipe';

@Component({
  standalone: true,
  imports: [FileSizePipe],
  template: `{{ 1048576 | fileSize }}`,
})
export class ExampleComponent {

}

Template
{{ 1048576 | fileSize }}

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: extension. Locale is controlled separately.
This pipe has no locale override.
Live template data
readonly value = 1048576;
readonly parameter0 = "MB";
{{ value | fileSize: parameter0 }}

Rendered output

1.00MB