deget/ddown; a downloader cli/api for dotnet

TL;DR

Alim Özdemir
2 min readJan 14, 2019

Install command

dotnet tool install -g deget
dotnet add package DDown

Example CLI command

deget https://github.com/OpenShot/openshot-qt/releases/download/v2.4.1/OpenShot-v2.4.1-x86_64.dmg

Hello everyone, I would like to introduce my first global tool for dotnet core ecosystem. This is one of my side projects that I have completed in my free time. It is a downloader just like ‘wget’ command in unix. It has partitioning, pause and resume features. Also, it is not only a CLI tool, but has a nuget package that you can include to your projects for downloading files.

I have started this project almost a year ago; My curiosity started with “can I do something like ‘free download manager’ in command line just like ‘wget’ command in unix”. I started digging into HTTP protocol documentation. And, I found “Range” option which I didn’t know before. With this option I can divide the file and download it with chucks.

So, the main idea behind the tool is to request the file information with only header option. After that, calculate the partitions and start download as a stream. I kept the partitions and the history files in user’s LocalApplicationData. Maybe, it can change in future.

Let’s see results.

Here is an example run command with four partitions.

deget https://github.com/OpenShot/openshot-qt/releases/download/v2.4.1/OpenShot-v2.4.1-x86_64.dmg -p 4
deget example output

I think, one of the most useful thing is that CLI downloads the file into current folder in which the command runs. But, if you want to change the download location you can just use -o flag. Also, if you want to download the file into user’s downloads folder you can just use -d flag. For more options,

-p, — partition (Default: 0) Set partition count. Default zero means system’s processor count-o, — output Default value is current folder that command runs.-r, — override (Default: false) Override the lastest download file with same name. Otherwise it will download the file with numbers (e.g. File (1).exe, File (2).exe).-b, — buffersize (Default: 8192) Set buffer size.-t, — timeout (Default: 10000) Set timeout parameter in miliseconds.-d, — downloadFolder (Default: false) The file download location set to User’s download folder.— help Display this help screen.— version Display version information.value pos. 0 Required. Link to download

DDown, API is ready to go, you can easily start with following lines for adding file download feature to your project. And, you can customize your options with DDown.Options class. For more information you can take a look at github.

Thank you for reading.

--

--