## `obiutils.DownloadFile` — Semantic Feature Overview - **Core Functionality**: Downloads a file from a given URL to a specified local path. - **HTTP Client Behavior**: - Uses `http.Get()` for simple, synchronous GET requests. - Validates the HTTP status code; aborts on non-200 responses with a descriptive error. - **Resource Management**: - Ensures proper cleanup via `defer resp.Body.Close()` and `defer out.Close()`. - **Progress Tracking**: - Integrates [`progressbar`](https://github.com/schollz/progressbar) to display real-time download progress. - Uses `DefaultBytes()` for a human-readable, byte-based indicator (e.g., "downloading 12.3 MB / 45.6 MB"). - **Efficient I/O**: - Leverages `io.Copy()` with an `io.MultiWriter` to stream data directly from the HTTP response body into both: - The target file (`out`) - The progress bar (to update on each chunk written) - **Error Handling**: - Returns early with wrapped errors for network failures, HTTP non-success codes, or file I/O issues. - **Simplicity & Usability**: - Minimal API surface: only two arguments (`url`, `filepath`). - No external configuration needed — ideal for CLI tools or batch scripts. - **Assumptions**: - No authentication, redirects, proxies, timeouts, or retries are implemented. - Designed for straightforward downloads where robustness is secondary to simplicity. - **Typical Use Cases**: - CLI utilities, build scripts, CI/CD pipelines. - Prototyping or internal tools where advanced download features are unnecessary. - **Limitations**: - Not suitable for large-scale or production-grade downloads without enhancements (e.g., retries, concurrency control).