72 lines
1.5 KiB
Markdown
72 lines
1.5 KiB
Markdown
# big-file-gen
|
|
|
|
Small Python CLI tools for creating and reading large files.
|
|
Useful for storage testing, transfer checks, and dumb-fun disk abuse.
|
|
|
|
## What it does
|
|
|
|
- create large binary files filled with zeros
|
|
- optionally create sparse files instead
|
|
- read files back and measure throughput
|
|
- optionally compute SHA256 while reading
|
|
- no third-party dependencies
|
|
|
|
## Usage
|
|
|
|
### Create a file
|
|
|
|
```bash
|
|
python make_big_file.py <output> <size> [--chunk-size SIZE] [--sparse] [--force] [--quiet]
|
|
```
|
|
|
|
Examples:
|
|
|
|
```bash
|
|
python make_big_file.py test.bin 15GB
|
|
python make_big_file.py dump.dat 1.5TiB --chunk-size 128MB
|
|
python make_big_file.py tiny.bin 500MB --quiet
|
|
python make_big_file.py sparse.img 20GB --sparse
|
|
python make_big_file.py test.bin 15GB --force
|
|
```
|
|
|
|
### Read a file
|
|
|
|
```bash
|
|
python read_big_file.py <input> [--chunk-size SIZE] [--hash] [--quiet]
|
|
```
|
|
|
|
Examples:
|
|
|
|
```bash
|
|
python read_big_file.py test.bin
|
|
python read_big_file.py dump.dat --chunk-size 128MB --hash
|
|
python read_big_file.py tiny.bin --quiet
|
|
```
|
|
|
|
## Size formats
|
|
|
|
Binary units are supported:
|
|
|
|
- `B`
|
|
- `KB`, `MB`, `GB`, `TB`, `PB`
|
|
- `KiB`, `MiB`, `GiB`, `TiB`, `PiB`
|
|
|
|
Plain numbers are treated as bytes.
|
|
|
|
## Exit codes
|
|
|
|
- `0` success
|
|
- `1` failure
|
|
- `130` interrupted
|
|
|
|
## Requirements
|
|
|
|
- Python 3.8+
|
|
- enough disk space for real writes
|
|
|
|
## Notes
|
|
|
|
- `--sparse` is handy when you want a huge file without actually burning the disk.
|
|
- `--force` overwrites an existing output file (without it, existing files are protected).
|
|
- `--hash` is SHA256, because anything weaker would be cosplay.
|