Git Product home page Git Product logo

fetchr's Introduction

fetchr

基于 hyper 和 tokio 开发的多线程 HTTP/HTTPS 下载工具。

特性

  • 命令行接口,每个进程只下载一个文件
  • 它会判断此任务是否支持 Range,从而决定是否进行多线程下载。
  • 支持断点续传
  • 下载进度和速度显示
  • 限速
  • 支持 HTTP/HTTPS
  • 自动重试

一些实现细节

下载开始后,一个元数据文件会被创建,用于保存下载进度等信息。文件名为 <file_name>.meta,其中 <file_name> 为下载文件的文件名。当程序重启时这个文件可能会被用到。所以如果你误删这个文件,可能导致无法继续下载。

每次最多同时有 N 个线程下载。每个线程的临时文件名为 <file_name>.partN,其中 <file_name> 为下载文件的文件名,N 为线程编号。当程序重启时这些文件可能会被用到。

如果一个工作线程下载失败,它会自动重试,直到成功为止。

如果一个工作线程下载成功,它会将下载的数据写入到一个临时文件中。然后这个线程会看其他线程的任务是否有未完成的,如果有,并且那个线程的剩余下载量大于 100KB,则会将那个线程的任务对半分,其中一半交给自己,另一半交给那个线程继续处理。

当程序收到 SIGINT 信号时,它会将所有缓冲区中的数据写入到临时文件中,然后退出。当下次运行时,它会检查临时文件是否存在,如果存在,则会继续下载。

当所有线程都完成下载后,它会将所有分块合并为一个文件。

fetchr's People

Contributors

pluveto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.