Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(hub): addingdownloadFileToCacheDirWithProgress function#1334

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
axel7083 wants to merge1 commit intohuggingface:main
base:main
Choose a base branch
Loading
fromaxel7083:feature/download-file-to-cache-dir-with-progress

Conversation

axel7083
Copy link
Contributor

@axel7083axel7083 commentedApr 2, 2025
edited
Loading

Description

Related to#1331

To be able to offer asnapshotDownloadWithProgress method, similar touploadFilesWithProgress the function called bysnapshotDownload should also have aWithProgress version.

Splitting thedownloadFileToCacheDir function

To avoid doing a big copy paste of thedownloadFileToCacheDir function, I needed to split it.

  • CreatedtypeDownloadFileToCacheDirParams to avoid repeating the params everywhere
  • CreatedfunctionpreparePaths to determine the paths based on the params
  • CreatedfunctionensureDirectories to mkdir the directories
  • CreatedfunctionprepareDownloadFileToCacheDir to handle all the functions above
  • CreatedfunctiondownloadAndStoreFile to do the heavy logic of downloading sodownloadFileToCacheDir is simpler.

Those functions are exported, sodownloadFileToCacheDirWithProgress can nicely use them

Testing

  • unit tests have been provided fordownloadFileToCacheDirWithProgress

gavrilikhin-d reacted with heart emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@coyotte508coyotte508Awaiting requested review from coyotte508coyotte508 will be requested when the pull request is marked ready for reviewcoyotte508 is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@axel7083

[8]ページ先頭

©2009-2025 Movatter.jp