⬆️ version bump to v4.5

- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5"
- Update version.txt from 4.29 → .30
(automated by Makefile)
This commit is contained in:
Eric Coissac
2026-04-07 08:36:50 +02:00
parent 670edc1958
commit 8c7017a99d
392 changed files with 18875 additions and 141 deletions
+37
View File
@@ -0,0 +1,37 @@
## `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).