davidvandertuijn / filesize
Filesize To Human Friendly
1.1
2022-03-07 20:06 UTC
Requires
- php: >=7.0.0
This package is auto-updated.
Last update: 2024-11-29 13:35:48 UTC
README
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.
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