aria2
一个下载工具
https://gist.github.com/maboloshi/a4b1f27567319d4a42352aadd036a578
Mac使用
不喜欢命令行的可以用这个方案,后台启动aria2,webui来管理下载。
brew install aria2
mkdir ~/.aria2 && cd ~/.aria2
touch aria2.conf
touch aria2.session
# 启动文件
touch ~/Library/LaunchAgents/aria2.plist
<!-- ~/Library/LaunchAgents/araia2.plist -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>aria2</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/aria2c</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/Users/maboloshi/Downloads</string>
</dict>
</plist>
# 检查plist语法是否正确
plutil ~/Library/LaunchAgents/aria2.plist
# 修改文件权限
chmod 644 ~/Library/LaunchAgents/aria2.plist
# 添加自启动项: aria2
launchctl load ~/Library/LaunchAgents/aria2.plist
# 删除自启动项: aria2
launchctl unload ~/Library/LaunchAgents/aria2.plist
# 启动服务: aria2
launchctl start aria2
# 停止服务: aria2
launchctl stop aria2
- 参考配置,写入一个
aria2.conf
文件中,注意修改下载路径为你自己的
#用户名
#rpc-user=user
#密码
#rpc-passwd=passwd
#上面的认证方式不建议使用,建议使用下面的token方式
#设置加密的密钥
#rpc-secret=token
#允许rpc
enable-rpc=true
#允许所有来源, web界面跨域权限需要
rpc-allow-origin-all=true
#允许外部访问,false的话只监听本地端口
rpc-listen-all=true
#RPC端口, 仅当默认端口被占用时修改
#rpc-listen-port=6800
#最大同时下载数(任务数), 路由建议值: 3
max-concurrent-downloads=5
#断点续传
continue=true
#同服务器连接数
max-connection-per-server=5
#最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要
min-split-size=10M
#单文件最大线程数, 路由建议值: 5
split=10
#下载速度限制
max-overall-download-limit=0
#单文件速度限制
max-download-limit=0
#上传速度限制
max-overall-upload-limit=0
#单文件速度限制
max-upload-limit=0
#断开速度过慢的连接
#lowest-speed-limit=0
#验证用,需要1.16.1之后的release版本
#referer=*
#文件保存路径, 默认为当前启动位置
dir=${HOME}/Downloads
#文件缓存, 使用内置的文件缓存, 如果你不相信Linux内核文件缓存和磁盘内置缓存时使用, 需要1.16及以上版本
#disk-cache=0
#另一种Linux文件缓存方式, 使用前确保您使用的内核支持此选项, 需要1.15及以上版本(?)
#enable-mmap=true
#文件预分配, 能有效降低文件碎片, 提高磁盘性能. 缺点是预分配时间较长
#所需时间 none < falloc ? trunc << prealloc, falloc和trunc需要文件系统和内核支持
file-allocation=prealloc
启动aria2,
-D
是后台运行aria2c –conf-path CONFIG_PATH -D
用webui来管理下载,clone下面这个项目,然后打开里面的
index.html
,在设置中把主机修改为localhost
,关闭SSL/TLS加密
git clone https://github.com/ziahamza/webui-aria2
如果没有报错就说明连接成功
百度云导出aria2连接的话,使用下面这个项目
- https://github.com/acgotaku/BaiduExporter.git
- 有关于chrome和firefox不同的安装方法
我自己写了一个shell来完成加载配置和打开浏览器的操作
# 后台启动
aria2c --conf-path=/Users/26huitailang/Desktop/self-scripts/aria2.conf -D
# 浏览器打开
open ./webui-aria2/index.html