Skip to content

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Sep 1, 2022

Signed-off-by: Glenn Jocher [email protected]

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

New function to determine the size of online files before downloading.

πŸ“Š Key Changes

  • Added a new function url_getsize in utils/downloads.py.
  • The url_getsize function uses the requests.head method to access file information.
  • Retrieves the 'content-length' from the response headers for the file size.

🎯 Purpose & Impact

  • Enables users to check file size before committing to a download: Prevents downloading large files unexpectedly, saving bandwidth and time.
  • Improves data handling within the code: By understanding the size of the data being processed, code can manage resources more efficiently.
  • Potential Impact: Might increase convenience and efficiency for users who deal with frequent downloads and want to automate size checks.

@glenn-jocher glenn-jocher self-assigned this Sep 1, 2022
@glenn-jocher glenn-jocher merged commit 223c59d into master Sep 1, 2022
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-2 branch September 1, 2022 10:13
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
* Add `url_getsize()` function

Signed-off-by: Glenn Jocher <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update downloads.py

Signed-off-by: Glenn Jocher <[email protected]>

Signed-off-by: Glenn Jocher <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant