Calculating fileSize / converting loaded bytes Výpočet velikost souboru / konverze naloženo bytů
The function calculates values from Bytes to KB or MB. Funkce vypočítá hodnoty z bytů na KB nebo MB.
Here we are first checking the value of bytes and if its less that zero or not a number returns null. Zde jsme první kontrola hodnoty bytů a pokud je její menší než nula nebo není číslo vrací null.
Otherwise we are calculating, V opačném případě jsme pro výpočet,
1024 Bytes = 1 KB. 1024 bajtů = 1 KB.
1024 KB = 1 MB 1024 kilobajt = 1 MB
/** / **
* Calculates the File size * Počítá Velikost souboru
* *
* @param bytes Loaded bytes or file size in bytes * @ Param bytů Nabito bytů nebo velikost souboru v bajtech
* @return converted bytes to String. * @ Return převést byty na String.
*/ * /
function fileSize( bytes : Number ) : String Funkce velikost souboru (v bytech: Number): Řetězec
{ (
if(bytes<0 number =” Number(bytes/1024);” string =” Math.round(fileSize)”>0?(fileSize>1024?(fileSize/1024).toFixed(2)+”MB”:((fileSize.toFixed(2))+”KB”)):(fileSize*1024)+”Bytes” ; if (bajty <0 počet = "Číslo (bytes/1024)," string = "Math.round (velikost souboru)"> 0? (velikost souboru> 1024? (fileSize/1024). toFixed (2) + "MB": ( (fileSize.toFixed (2)) + "KB ")):( velikost souboru * 1024) +" bajtů ";
return FileSize_str; návrat FileSize_str;
} )
Download Source file Stáhněte si zdrojový soubor











































Leave your response! Nechte Vaši odpověď!