byte type
Project description
bytetype
A simple Byte type
Install
pip install bytetype
Usage
NOTE that: -
ByteSize
corresponds to the base numeric value to use i.e. 1024
-
BytesUnit
corresponds to the string unit to use i.e. "KB"
Examples
Enums
get byte sizes
ByteSize.memdict
get byte size index
{k: bytes_idx(v) for k, v in ByteSize.items}
convert unit to size
BytesUnit.from_bytes(ByteSize.MB), BytesUnit.from_bytes(ByteSize.GB)
Convert bytes to size
{k: bytes_to_size(v * (2*i+1)) for i, (k, v) in enumerate(ByteSize.items)}
{bytes_to_size(ByteSize.KB * i) for i in range(1, 10)}
Iterate over files
for e in os.listdir():
print(e, Bytes.from_file(e))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bytetype-0.0.2.tar.gz
(11.5 kB
view hashes)
Built Distribution
bytetype-0.0.2-py3-none-any.whl
(13.0 kB
view hashes)