# Byte-Formatter
Byte-Formatter is a Python project for formatting bytes into a human-readable format. It supports various units and styles, including binary, decimal, SI units, and Unix-style units.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Local Usage](#local-usage)
- [Basic Usage](#basic-usage)
- [Advanced Options](#advanced-options)
- [Examples](#examples)
- [Features](#features)
- [License](#license)
## Installation
To install Byte-Formatter, you need to have Python 3.7 or higher and Poetry installed on your system. Follow these steps:
1. Clone the repository:
```bash
git clone https://github.com/yourusername/byte-formatter.git
```
2. Navigate to the project directory:
```bash
cd byte-formatter
```
3. Install the dependencies using Poetry:
```bash
poetry install
```
## Usage
### Local Usage
To use Byte-Formatter locally, you can run it through Poetry:
```bash
# Output: 12.3 KB
poetry run byte-formatter 12345
```
This command will format the number `12345` into a human-readable byte format based on the default settings.
### Basic Usage
To format a number into a human-readable byte format with default settings (decimal units and one decimal place):
```bash
# Output: 12.3 KB
byte-formatter 12345
```
### Advanced Options
You can customize the output using the following options:
- `-b, --binary`: Use binary (base-1024) units (KiB, MiB, etc.).
- `-p, --precision <number>`: Set the number of decimal places.
- `-s, --suffix <text>`: Append a custom suffix to the formatted size.
- `-t, --strip-trailing-zeros`: Remove trailing zeros from the formatted size.
- `-S, --si-units`: Use SI units (kB, MB, etc.) which are base-1000 but with different symbols.
- `-U, --uppercase-units`: Use uppercase unit symbols (KB, MB). This is the default setting.
- `-l, --lowercase-units`: Use lowercase unit symbols (kb, mb), overriding the default uppercase setting.
- `-v, --verbose`: Use verbose unit names (Bytes, Kilobytes, etc.).
- `-x, --unix-style`: Use single-letter Unix-style unit names (B, K, M, G, T, P).
### Examples
Format a size using binary units with two decimal places:
```bash
# Output: 12.06 KiB
poetry run byte-formatter 12345 -b -p 2
```
Format a size with verbose unit names and no trailing zeros:
```bash
# Output: 2.0 Kilobytes
poetry run byte-formatter 2048 -v -t
```
Use SI units with lowercase symbols and a custom suffix:
```bash
# Output: 5.0 MB of data
poetry run byte-formatter 5000000 -S -l -s " of data"
```
## Features
Byte-Formatter offers the following features:
- Support for binary (base-1024) and decimal (base-1000) units.
- Option to use SI units with different symbols.
- Verbose and Unix-style unit names.
- Customizable precision and option to strip trailing zeros.
## License
Byte-Formatter is licensed under the MIT License. See the LICENSE file for more details.
Raw data
{
"_id": null,
"home_page": "https://github.com/rmkane/byte-formatter",
"name": "byte-formatter",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.7",
"maintainer_email": null,
"keywords": "byte, formatter, cli",
"author": "Ryan Kane",
"author_email": "rmkane@proton.me",
"download_url": "https://files.pythonhosted.org/packages/c0/a6/926282282abefa8e13a53c68965496573e889cf57826004bab03461842a7/byte_formatter-0.0.2.tar.gz",
"platform": null,
"description": "# Byte-Formatter\n\nByte-Formatter is a Python project for formatting bytes into a human-readable format. It supports various units and styles, including binary, decimal, SI units, and Unix-style units.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n - [Local Usage](#local-usage)\n - [Basic Usage](#basic-usage)\n - [Advanced Options](#advanced-options)\n - [Examples](#examples)\n- [Features](#features)\n- [License](#license)\n\n## Installation\n\nTo install Byte-Formatter, you need to have Python 3.7 or higher and Poetry installed on your system. Follow these steps:\n\n1. Clone the repository:\n ```bash\n git clone https://github.com/yourusername/byte-formatter.git\n ```\n2. Navigate to the project directory:\n ```bash\n cd byte-formatter\n ```\n3. Install the dependencies using Poetry:\n ```bash\n poetry install\n ```\n\n## Usage\n\n### Local Usage\n\nTo use Byte-Formatter locally, you can run it through Poetry:\n\n```bash\n# Output: 12.3 KB\npoetry run byte-formatter 12345\n```\n\nThis command will format the number `12345` into a human-readable byte format based on the default settings.\n\n### Basic Usage\n\nTo format a number into a human-readable byte format with default settings (decimal units and one decimal place):\n\n```bash\n# Output: 12.3 KB\nbyte-formatter 12345\n```\n\n### Advanced Options\n\nYou can customize the output using the following options:\n\n- `-b, --binary`: Use binary (base-1024) units (KiB, MiB, etc.).\n- `-p, --precision <number>`: Set the number of decimal places.\n- `-s, --suffix <text>`: Append a custom suffix to the formatted size.\n- `-t, --strip-trailing-zeros`: Remove trailing zeros from the formatted size.\n- `-S, --si-units`: Use SI units (kB, MB, etc.) which are base-1000 but with different symbols.\n- `-U, --uppercase-units`: Use uppercase unit symbols (KB, MB). This is the default setting.\n- `-l, --lowercase-units`: Use lowercase unit symbols (kb, mb), overriding the default uppercase setting.\n- `-v, --verbose`: Use verbose unit names (Bytes, Kilobytes, etc.).\n- `-x, --unix-style`: Use single-letter Unix-style unit names (B, K, M, G, T, P).\n\n### Examples\n\nFormat a size using binary units with two decimal places:\n\n```bash\n# Output: 12.06 KiB\npoetry run byte-formatter 12345 -b -p 2\n```\n\nFormat a size with verbose unit names and no trailing zeros:\n\n```bash\n# Output: 2.0 Kilobytes\npoetry run byte-formatter 2048 -v -t\n```\n\nUse SI units with lowercase symbols and a custom suffix:\n\n```bash\n# Output: 5.0 MB of data\npoetry run byte-formatter 5000000 -S -l -s \" of data\"\n```\n\n## Features\n\nByte-Formatter offers the following features:\n\n- Support for binary (base-1024) and decimal (base-1000) units.\n- Option to use SI units with different symbols.\n- Verbose and Unix-style unit names.\n- Customizable precision and option to strip trailing zeros.\n\n## License\n\nByte-Formatter is licensed under the MIT License. See the LICENSE file for more details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python project for formatting bytes",
"version": "0.0.2",
"project_urls": {
"Documentation": "https://github.com/rmkane/byte-formatter",
"Homepage": "https://github.com/rmkane/byte-formatter",
"Repository": "https://github.com/rmkane/byte-formatter"
},
"split_keywords": [
"byte",
" formatter",
" cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8df5c574fed1d4321fa741d0252a411fa773ed4a71c31c23454a16e8fddbc1c5",
"md5": "a5d48285b711b0a9d2c31b111751a7a5",
"sha256": "74221d8d9984cf174d16fb7ffbbaefe032376814b6d175683db8630696430f30"
},
"downloads": -1,
"filename": "byte_formatter-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a5d48285b711b0a9d2c31b111751a7a5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.7",
"size": 6657,
"upload_time": "2024-07-10T01:03:45",
"upload_time_iso_8601": "2024-07-10T01:03:45.971532Z",
"url": "https://files.pythonhosted.org/packages/8d/f5/c574fed1d4321fa741d0252a411fa773ed4a71c31c23454a16e8fddbc1c5/byte_formatter-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c0a6926282282abefa8e13a53c68965496573e889cf57826004bab03461842a7",
"md5": "f8d8d8be76ccd55a0813a7543679e4ef",
"sha256": "cd89c410412a9528a1ef726412a92133651fd1895b9c1cf0b5b0670c93c41508"
},
"downloads": -1,
"filename": "byte_formatter-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "f8d8d8be76ccd55a0813a7543679e4ef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.7",
"size": 5201,
"upload_time": "2024-07-10T01:03:47",
"upload_time_iso_8601": "2024-07-10T01:03:47.128773Z",
"url": "https://files.pythonhosted.org/packages/c0/a6/926282282abefa8e13a53c68965496573e889cf57826004bab03461842a7/byte_formatter-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-10 01:03:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rmkane",
"github_project": "byte-formatter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "byte-formatter"
}