public function test_it_converts_bytes_to_readable_strings() { $this->assertEquals('0 B', File::readableSize(0)); $this->assertEquals('1 KB', File::readableSize(1025, 0)); $this->assertEquals('1.1 MB', File::readableSize(1024 * 1024 + 1024 * 100, 2)); }
/** * Calculate the file size in human readable byte notation. * @param int $precision (_optional_) Number of decimal places to include. * @return string */ public function readableSize($precision = 1) { return File::readableSize($this->size, $precision); }