Filesize To Human Friendly

1.1 2022-03-07 20:06 UTC

This package is auto-updated.

Last update: 2024-11-29 13:35:48 UTC


README

Total Downloads Latest Stable Version License

Filesize

The Filesize tool allows users to determine the size of files in a variety of formats, providing crucial information for data management and analysis. Understanding file sizes is essential for effective storage planning, data transfer, and resource allocation.

"Buy Me A Coffee"

Install

composer require davidvandertuijn/filesize

Usage

use Davidvandertuijn\Filesize;
Filesize::toHumanFriendly(
    1024000, // Bytes
    'kB', // Force Unit
    '%01.2f %s', // Format
    'SI' // Standard
);

SI standard (1000 bytes in a kilobyte)

Filesize::toHumanFriendly(1024000); // 1.02 MB

Force Unit

Filesize::toHumanFriendly(1024000, 'kB'); // 1024.00 kB

Format

Filesize::toHumanFriendly(1024000, null, '%01.3f %s'); // 1.024 MB

IEC standard (1024 bytes in a kibibyte)

Filesize::toHumanFriendly(1048576, null, null, 'IEC'); // 1.00 MiB