mirror of
				https://github.com/KevinMidboe/Node-Com-Handler.git
				synced 2025-10-29 17:50:27 +00:00 
			
		
		
		
	Changed deviding size from 1024 to 1000 to get more correct diskSpace
This commit is contained in:
		| @@ -9,9 +9,9 @@ from os import statvfs | ||||
| 	 | ||||
| def sizeof(num, suffix='B'): | ||||
| 	for unit in ['','K','M','G','T','P','E','Z']: | ||||
| 		if abs(num) < 1000.0: | ||||
| 		if abs(num) < 1024.0: | ||||
| 			return "%3.1f%s%s" % (num, unit, suffix) | ||||
| 		num /= 1000.0 | ||||
| 		num /= 1024.0 | ||||
| 	return "%.1f%s%s" % (num, 'Y', suffix) | ||||
|  | ||||
| def diskUsage(path='/'): | ||||
| @@ -23,5 +23,5 @@ def diskUsage(path='/'): | ||||
| 	return { 'left':sizeof(byteLeft), 'used':sizeof(byteUsed), 'total':sizeof(byteTotal) } | ||||
|  | ||||
| if __name__=="__main__": | ||||
| 	n = diskUsage('/') | ||||
| 	n = diskUsage('/media/hdd1') | ||||
| 	print(n) | ||||
		Reference in New Issue
	
	Block a user