size-file 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
size_file/__init__.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
def human_readable(size_in_bytes, decimals=2):
|
|
2
|
+
if size_in_bytes == 0:
|
|
3
|
+
return "0 B"
|
|
4
|
+
|
|
5
|
+
units = ["B", "KB", "MB", "GB", "TB", "PB"]
|
|
6
|
+
i = 0
|
|
7
|
+
while size_in_bytes >= 1024 and i < len(units) - 1:
|
|
8
|
+
size_in_bytes /= 1024.0
|
|
9
|
+
i += 1
|
|
10
|
+
|
|
11
|
+
# Округляем до нужного количества знаков
|
|
12
|
+
return f"{size_in_bytes:.{decimals}f} {units[i]}"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: size-file
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Convert bytes to human-readable file sizes
|
|
5
|
+
Author-email: MulticNews <escape.from.the.pickaxe@gmail.com>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
Привет! Данная библиотека создана для упрощения размеров файлов.
|
|
10
|
+
|
|
11
|
+
Пример:
|
|
12
|
+
676952228Б = 645.5920МБ
|
|
13
|
+
|
|
14
|
+
Спасибо за скачивание!
|
|
15
|
+
|
|
16
|
+
А ознакомиться с остальными моими работами можно на моём профиле (https://multicnews.gitverse.site/myportfolio) или же на моей странице PyPI (https://pypi.org/user/MulticNews/)
|
|
17
|
+
|
|
18
|
+
–––––––––––––––––––––––––––
|
|
19
|
+
|
|
20
|
+
Hi! This library is designed to simplify file sizes.
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
676952228B = 645.5920MB
|
|
24
|
+
|
|
25
|
+
Thanks for downloading!
|
|
26
|
+
|
|
27
|
+
And you can see the rest of my work on my profile (https://multicnews.gitverse.site/myportfolio) or on my PyPI page (https://pypi.org/user/MulticNews/)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
size_file/__init__.py,sha256=W-LFENdhJBL83wIIQWT-UbZ3BdtgpxhnNfTrtMFgwoo,403
|
|
2
|
+
size_file-1.0.0.dist-info/METADATA,sha256=umNwCsTdIiK1s32jidaMSsHpxk4SxlmFS2cfbRWqAsg,1036
|
|
3
|
+
size_file-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
4
|
+
size_file-1.0.0.dist-info/top_level.txt,sha256=aTnfmRICWhgnkyl46WSLGGVQ6CdK1RKvYbvHp3Qc_oU,10
|
|
5
|
+
size_file-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
size_file
|