-
-
Save giabao/8414868 to your computer and use it in GitHub Desktop.
Use aria2c to download file1. add params (to speedup downloading): -s16 -x16 -k1M2. add --check-certificate=false3. simulate -o option of curl: dl -o /dir/file url will download file to /dir/file insteads of ./dir/file_______Install:1. apt-get install aria2c2. Download & chmod a+x /usr/bin/dl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #Use aria2c to download file | |
| #1. add params (to speedup downloading): -s16 -x16 -k1M | |
| #2. add --check-certificate=false --file-allocation=falloc | |
| # see http://aria2.sourceforge.net/manual/en/html/aria2c.html#cmdoption--file-allocation | |
| #3. simulate -o option of curl: | |
| # dl -o /dir/file url | |
| # will download file to /dir/file insteads of ./dir/file | |
| args=" $@" | |
| # parse -o | |
| pat=".*\(\s-o\s*[^ ]*\).*" | |
| val=`expr match "$args" "$pat"` | |
| #parse --out= | |
| if [ ! "$val" ]; then | |
| pat=".*\(\s--out=\s*[^ ]*\).*" | |
| val=`expr match "$args" "$pat"` | |
| fi | |
| if [ "$val" ]; then | |
| args="-d /$args" | |
| fi | |
| args="-s16 -x16 -k1M --check-certificate=false --file-allocation=falloc $args" | |
| exec /usr/bin/aria2c $args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment