oskarstark/readable-filesize-extension

A Twig extension to convert filesize to human readable string

0.2.0 2021-03-19 12:36 UTC

This package is auto-updated.

Last update: 2021-04-19 12:55:23 UTC


README

A Twig extension to convert filesize to human readable string.

CI

Installation

composer require oskarstark/readable-filesize-extension
# config/services.yaml
services:
    OskarStark\Twig\ReadableFilesizeExtension:
        tags: ['twig.extension']

Usage

// file.size = 1024

{{ file.size|readable_filesize() }} # prints '1 KB'
{{ file.size|readable_filesize(2) }} # prints '1.00 KB'