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

Set default outfile by path #7

Closed mpldr closed 4 years ago

mpldr commented 4 years ago

Hello, I wanted to ask whether setting a default download path was a wanted feature. so the out flag is optional.

For example when downloading a list of files (another feature perhaps?) it can be tedious to always provide the outfile. sure, its possible using xargs and some replacements but is that how it should be?

so I'd like to suggest the following:

If the outpath is undefined the filepath is parsed from the URL, or if empty replaced by index. Meaning:

http://example.com/some/path/video.mp4?hash=deadbeef&expires=123456789 -> video.mp4
http://example.com/some/path/video.mp4 -> video.mp4
http://example.com/ -> index
http://example.com/index.html -> index.html
http://example.com/?page=about -> index // to keep it simple
http://example.com/about.php?session=asdf -> about.php

I would implement this if it is a wanted feature.

melbahja commented 4 years ago

yes it would be nice 👍

mpldr commented 4 years ago

I'd like to propose the following additional test-cases: additional_testcases.diff.txt

melbahja commented 4 years ago

can we replace all index cases and this additional cases with got.out or index.out, I think you should have a file extension on windows (I don't use it, IDK).

mpldr commented 4 years ago

Well, having no extension on Windows is basically the same as having a file of an unknown type. The only difference I'm aware of would be that the explorer shows the type as "OUT-file" instead of "file". The only way I know of to mess with Windows when it comes to files is by appending spaces. The explorer doesn't like that. I can try this out on a Windows machine.

mpldr commented 4 years ago

But if you feel one of these to be better feel free to change it.

melbahja commented 4 years ago

I've used .output ext, we can detect file type from first chunk but we can do this later...