@rotzbua/ngx-filesize
TypeScript icon, indicating that this package has built-in type declarations

16.0.0 • Public • Published

ngx-filesize

A filesize.js pipe for Angular.

Preparing

Install

Install both packages with:

npm install ngx-filesize filesize

Dependency

The filesize.js is not compiled into the ngx-filesize rather than has a peer dependency. So you can maintain the filesize dependency by your own.

Disable warning

app.component.ts depends on 'filesize'. CommonJS or AMD dependencies can cause optimization bailouts.

Warning can be disabled by allowing common js.

Usage

Usage in your module

Required for every module where you use it in your component.

import {NgxFilesizeModule} from 'ngx-filesize';

// ...

@NgModule({
  // ...
  imports: [
    // ...
    NgxFilesizeModule,
    // ...
  ]
  // ...
})

Usage in your component template

Without any option:

{{bytes | filesize}}

With an option:

{{bytes | filesize: {base: 10} }

More options and documentation at https://filesizejs.com/.

Versioning

The package version should match used angular version to build the library. Nevertheless, the peer dependency to angular allows higher angular versions to avoid strict versioning problems.

Source project

https://github.com/amitdahan/ngx-filesize

Package Sidebar

Install

npm i @rotzbua/ngx-filesize

Weekly Downloads

28

Version

16.0.0

License

MIT

Unpacked Size

15.2 kB

Total Files

12

Last publish

Collaborators

  • rotzbua