Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function formatSizeUnits(bytes) {
- if ((bytes >> 40) & 0x3FF)
- bytes = (bytes >>> 30) + '.' + (bytes & (4 * 0x3FF)) + ' TB';
- else if ((bytes >> 30) & 0x3FF)
- bytes = (bytes >>> 30) + '.' + (bytes & (3 * 0x3FF)) + ' GB';
- else if ((bytes >> 20) & 0x3FF)
- bytes = (bytes >>> 20) + '.' + (bytes & (2 * 0x3FF)) + ' MB';
- else if ((bytes >> 10) & 0x3FF)
- bytes = (bytes >>> 10) + '.' + (bytes & (0x3FF)) + ' KB';
- else if ((bytes >> 1) & 0x3FF)
- bytes = (bytes >>> 1) + ' Bytes';
- else
- bytes = bytes + 'Byte';
- return bytes;
- }
Advertisement
Add Comment
Please, Sign In to add comment