Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add url_getsize() function #9247

Merged
merged 3 commits into from
Sep 1, 2022
Merged

Add url_getsize() function #9247

merged 3 commits into from
Sep 1, 2022

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.

None yet

1 participant