Skip to content

Allow configurable file size standard (SI, JEDEC, or IEC) in FileSizePipe #5079

Description

@MMilosz

Is your feature request related to a problem? Please describe.

Currently, the FileSizePipe uses a hard-coded binary standard (JEDEC) for formatting file sizes. Changing the standard requires modifying the source code.

For comparison between different standards, look at ss below:

SI

1 MB = 1000 kB

Image

JEDEC

1 MB = 1024 KB

Image

IEC

1 MiB = 1024 KiB

Image

Describe the solution you'd like

Make file size format configurable.

Here's where it can be found:

export class FileSizePipe implements PipeTransform {
transform(bytes: number = 0, precision: number = 2): string {
return filesize(bytes, { standard: 'jedec', round: precision });
}

Describe alternatives or workarounds you've considered

Additional information

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    • Status
      👀 Needs Discussion / Analysis

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions