Skip to content

Instantly share code, notes, and snippets.

msteini82

Block or report user

Report or block msteini82

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@msteini82
msteini82 / file-size.pipe.ts
Last active Nov 12, 2019 — forked from JonCatmull/file-size.pipe.ts
Angular2 + TypeScript file size Pipe/Filter. Convert bytes into largest possible unit. e.g. 1024 => 1 KB - Using standard decimal pipe to convert number to local format.
View file-size.pipe.ts
import { Pipe, PipeTransform, LOCALE_ID, Inject } from '@angular/core';
import {DecimalPipe} from '@angular/common';
/*
* Convert bytes into largest possible unit.
* Takes an precision argument that defaults to 2.
* Usage:
* bytes | fileSize:precision
* Example:
* {{ 1024 | fileSize}}
You can’t perform that action at this time.