oskarstark/readable-filesize-extension

A Twig extension to convert filesize to human readable string

1.2.1 2022-10-28 11:50 UTC

This package is auto-updated.

Last update: 2024-02-15 11:45:49 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'