Skip to content

A Twig extension to convert filesize to human readable string.

License

Notifications You must be signed in to change notification settings

OskarStark/readable-filesize-extension

Repository files navigation

readable-filesize-extension

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'