aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/angular/bytes.pipe.ts
blob: f3f57b8255e965a314aae3ab0452c63832abc046 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import { Pipe, PipeTransform } from '@angular/core'
import { getBytes } from '@root-helpers/bytes'

// Thanks: https://github.com/danrevah/ngx-pipes/blob/master/src/ng-pipes/pipes/math/bytes.ts

@Pipe({ name: 'bytes' })
export class BytesPipe implements PipeTransform {

  transform (value: number, precision?: number | undefined): string | number {
    return getBytes(value, precision)
  }
}