当前位置: 首页 > news >正文

github加速下载@powershell命令行内加速下载github资源@获取镜像加速后的链接

文章目录

    • github加速下载辅助函数(powershell)👺
      • 安装powershell模块
      • 相关命令
      • 使用示例
      • 检查加速后的链接是否可用
      • 直接加速下载指定链接👺
    • 选择下载方式👺
      • FAQ
    • 其他加速
      • 克隆加速
      • 综合加速

github加速下载辅助函数(powershell)👺

  • 在powershell命令行获取加速后的链接(可以获取多个加速链接,提高可用性)
  • 使用合适的下载方式下载链接资源

安装powershell模块

获取github资源的加速链接文件/仓库加速

为了便于用户使用,我将相关功能组织成了一个powershell模块集合,您可以通过gitee来一键部署(仓库很小)

  • PwshModuleByCxxu.md · xuchaoxin1375/scripts - 码云 - 开源中国 (gitee.com)

然后直接调用相关函数即可(命令内调用了其他多个函数,不便在此粘贴源代码)

相关命令

  • Get-SpeedUpUrl (获取加速后的github资源下载链接)
  • Get-AvailableGithubMirrors
  • Invoke-GithubResourcesSpeedup (可以用来直接下载github资源)

下面给出用例

使用示例

PS🌙[BAT:98%][MEM:52.39% (8.05/15.37)GB][22:35:01]
# [cxxu@BEFEIXIAOXINLAP][<W:192.168.1.77>][~\Desktop]
PS> Get-SpeedUpUrl https://github.com/rayenghanmi/RyTuneX/releases/download/v0.8.2/RyTuneX.Setup.zip -LinkNumber 6 -Silent |Tee-Object $home/downloads/speedlinks
Mode:Silent $LinkNumber=6
Checking available Mirrors...https://gh.con.shhttps://cf.ghproxy.cchttps://github.moeyy.xyzhttps://gh.ddlc.top.https://ghproxy.nethttps://ghps.cchttps://sciproxy.comhttps://github.ur1.funhttps://hub.gitmirror.comhttps://mirror.ghproxy.comhttps://ghproxy.cchttps://ghproxy.homeboyc.cnhttps://slink.ltdhttps://gh-proxy.com.https://gh.noki.icu.Available Mirrors:0: Use No Mirror1: https://gh.con.sh2: https://cf.ghproxy.cc3: https://github.moeyy.xyz4: https://ghproxy.net5: https://ghps.cc6: https://sciproxy.com7: https://github.ur1.fun8: https://hub.gitmirror.com9: https://mirror.ghproxy.com10: https://ghproxy.cc11: https://ghproxy.homeboyc.cn12: https://slink.ltd
https://gh.con.sh/https://github.com/rayenghanmi/RyTuneX/releases/download/v0.8.2/RyTuneX.Setup.zip
https://cf.ghproxy.cc/https://github.com/rayenghanmi/RyTuneX/releases/download/v0.8.2/RyTuneX.Setup.zip
https://github.moeyy.xyz/https://github.com/rayenghanmi/RyTuneX/releases/download/v0.8.2/RyTuneX.Setup.zip
https://ghproxy.net/https://github.com/rayenghanmi/RyTuneX/releases/download/v0.8.2/RyTuneX.Setup.zip
https://ghps.cc/https://github.com/rayenghanmi/RyTuneX/releases/download/v0.8.2/RyTuneX.Setup.zip
https://sciproxy.com/https://github.com/rayenghanmi/RyTuneX/releases/download/v0.8.2/RyTuneX.Setup.zip
  • 可以看到,命令返回了6个可选用的加速过的下载链接,您可以使用其中的任意一个链接尝试下载该资源

检查加速后的链接是否可用

PS> get-availableGithubMirrors -Mirrors (Get-SpeedUpUrl https://github.com/hellzerg/optimizer/releases/download/16.7/Optimizer-16.7.exe -Silent -LinkNumber 8) -TimeOutSec 5
Mode:Silent $LinkNumber=8
Checking available Mirrors...https://gh.ddlc.top.https://cf.ghproxy.cchttps://github.moeyy.xyzhttps://gh.con.shhttps://ghproxy.cchttps://ghproxy.nethttps://ghproxy.homeboyc.cnhttps://ghps.cchttps://hub.gitmirror.comhttps://gh-proxy.comhttps://sciproxy.comhttps://gh.noki.icu.https://github.ur1.fun.https://mirror.ghproxy.com.https://slink.ltdAvailable Mirrors:0: Use No Mirror1: https://cf.ghproxy.cc2: https://github.moeyy.xyz3: https://gh.con.sh4: https://ghproxy.cc5: https://ghproxy.net6: https://ghproxy.homeboyc.cn7: https://ghps.cc8: https://hub.gitmirror.com9: https://gh-proxy.com10: https://sciproxy.com11: https://slink.ltd
Checking available Mirrors...Available Mirrors:0: Use No Mirror1: https://github.moeyy.xyz/https://github.com/hellzerg/optimizer/releases/download/16.7/Optimizer-16.7.exe2: https://ghproxy.net/https://github.com/hellzerg/optimizer/releases/download/16.7/Optimizer-16.7.exe
  • 上述试验表明众多镜像加速后的下载链接中,反应较快的只有2个

直接加速下载指定链接👺

模块提供了Invoke-githubResourcesSpeedup ,接受链接参数(默认尝试调用aria2c进行多线程下载)

Invoke-githubResourcesSpeedup https://github.com/hellzerg/optimizer/releases/download/16.7/Optimizer-16.7.exe -Verbose
....
Select the number(s) of the mirror you want to use [0~11] ?(default: 1): 7
Selected mirror:[https://ghproxy.net
]
VERBOSE: https://ghproxy.net/https://github.com/hellzerg/optimizer/releases/download/16.7/Optimizer-16.7.exe
Download from: https://ghproxy.net/https://github.com/hellzerg/optimizer/releases/download/16.7/Optimizer-16.7.exe
VERBOSE: aria2c  https://ghproxy.net/https://github.com/hellzerg/optimizer/releases/download/16.7/Optimizer-16.7.exe -d C:\Users\cxxu/Downloads  -s 16 -x 16 -k 1M09/21 23:20:31 [NOTICE] Downloading 1 item(s)
[#c82bd6 0B/0B CN:1 DL:0B]
09/21 23:20:33 [NOTICE] File already exists. Renamed to C:/Users/cxxu/Downloads/Optimizer-16.7.3.exe.09/21 23:20:33 [NOTICE] Removed the defunct control file C:/Users/cxxu/Downloads/Optimizer-16.7.3.exe.aria2 because the download file C:/Users/cxxu/Downloads/Optimizer-16.7.3.exe doesn't exist.
[#c82bd6 1.8MiB/2.4MiB(73%) CN:1 DL:411KiB ETA:1s]

选择下载方式👺

  • 即使加速镜像返回的链接比原链接要快,但是想要更好的下载速度还需要一款多线程下载工具
    • 您可以用得到的链接使用专业的下载工具下载,例如IDM等,或者跨平台的其他下载器,当然更方便的是使用aria2©下载
    • 下载器可以使用aria2c,idm,或者powershell自带的invoke-webrequest也是可以的,甚至使用浏览器下载链接资源也是可以的

FAQ

  • 注意,多线程下载工具不总是最推荐的方式,有时候服务器对多线程有限制,可能导致下不动,这时候可以更换为单线程下载
    • 例如aria2,有时候会预处理挺长一段时间然后才开始下载,甚至直接下不动
    • 因此Scoop这类包下载工具虽然在安装了aria2后默认启用,但是会给出警告
    • 在windows terminal这类现代还工具中,访问终端内的链接很方便,按住ctrl
  • 如果还是不行,那么更换其他加速后的链接试试

其他加速

克隆加速

  • 克隆github仓库的加速资源有很多,比如使用cgit克隆

  • cgit: cgit是一个github快速下载器,使用国内镜像,clone速度可达 (gitee.com)

  • 网达极客社区 (gitclone.com)

    • Speed up github - 网达极客社区 (gitclone.com)
  • 使用gitee,gitcode等托管站导入github加速代码仓库(但是release等文件不容易下载)

综合加速

【镜像站点搜集】 · Issue #116 · hunshcn/gh-proxy (github.com)


http://www.mrgr.cn/news/33110.html

相关文章:

  • 【成品论文】2024年华为杯研赛E题25页高质量成品论文(后续会更新
  • 代码编辑器 —— Notepad++ 实用技巧
  • 51单片机——独立按键
  • 一个安卓鸿蒙化工具
  • 银河麒麟桌面操作系统V10(SP1)离线升级SSH(OpenSSH)服务
  • CompletableFuture的allOf一定不要乱用!血泪史复盘
  • 01-ZYNQ linux开发环境安装,基于Petalinux2023.2和Vitis2023.2
  • go 安装依赖超时
  • msvcp140.dll0丢失的解决方法,总结6种靠谱的解决方法
  • Spring Boot实战:使用策略模式优化商品推荐系统
  • 数据结构:内部排序
  • Spring Boot实战:使用@Import进行业务模块自动化装配
  • Jboss Administration Console弱⼝令
  • 2024年华为杯-研赛F题论文问题一二讲解+代码分享
  • 计算机毕业设计 基于Python的校园个人闲置物品换购平台 闲置物品交易平台 Python+Django+Vue 前后端分离 附源码 讲解 文档
  • Vision Transformer (ViT)、Swin Transformer 和 Focal Transformer
  • 9、等保测评介绍
  • (项目管理系列课程)项目启动阶段:项目整合管理-制定项目章程
  • 【RabbitMQ】消息分发、事务
  • 【MySQL】 索引