Skip to content

Commit

Permalink
Use .part suffix to represent partially downloaded files
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed May 12, 2024
1 parent fc243a7 commit eeb6995
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gdown/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def download(

existing_tmp_files = []
for file in os.listdir(osp.dirname(output) or "."):
if file.startswith(osp.basename(output)):
if file.startswith(osp.basename(output)) and file.endswith(".part"):
existing_tmp_files.append(osp.join(osp.dirname(output), file))
if resume and existing_tmp_files:
if len(existing_tmp_files) != 1:
Expand All @@ -325,7 +325,7 @@ def download(
# mkstemp is preferred, but does not work on Windows
# https://github.com/wkentaro/gdown/issues/153
tmp_file = tempfile.mktemp(
suffix=tempfile.template,
suffix=".part",
prefix=osp.basename(output),
dir=osp.dirname(output),
)
Expand Down

0 comments on commit eeb6995

Please sign in to comment.