davidvandertuijn / filesize
Filesize To Human Friendly
Installs: 836
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/davidvandertuijn/filesize
Requires
- php: >=7.0.0
This package is auto-updated.
Last update: 2025-09-29 02:00:16 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