melbahja / got

Got: Simple golang package and CLI tool to download large files faster 🏃 than cURL and Wget!
MIT License
714 stars 45 forks source link

add batch download support, filename parse from url, and save path support #15

Closed xurwxj closed 4 years ago

xurwxj commented 4 years ago

add filename parse from url add save path support add batch download support

melbahja commented 4 years ago

Adding an extra HEAD request have 3 issues: 1 - Adds extra ms to download time.
2 - I don't trust Content-Disposition for security reasons for e.g: Content-Disposition: attachment; filename="/../../../../etc/path" 3 - Some servers does not allow HEAD see #3

The user should specify the download path to avoid any problems


And for batch download it's a great idea, to make it simple I propose to be like this:

Read from stdin:

cat file.txt | got --save /path

and from flag:

got -f file.txt --save /path
xurwxj commented 4 years ago

@melbahja u can change:

return filename

to

return filepath.Base(filename)

Then can avoid the security reasons

There may be no chunks download for those servers not supported head, just same for byte-range head.

I like batch download from flag:

got -f file.txt --save /path

although in my pull request is:

got --bf file.txt --save /path
melbahja commented 4 years ago

Batch download and save to directory has been implemented and released in v0.2.0. Thanks