This is a command line tool. Written by Golang.

Imputes/fdlr: A command line tool for file downloads (


  • support HTTP and HTTPS
  • you can set the number of parallel to download
  • download batches of files concurrently
  • resume incomplete downloads

I hope you will play with it.

When a goroutine can start other goroutines, and those goroutines start other goroutines, and so on, then the first goroutine should be able to send cancellation signals to all embedded goroutines.

The sole purpose of the context package is to perform cancellation signals between goroutines, regardless of how they were generated.

The interface of the Context is defined as:

type Context interface {
Deadline() (deadline time.Time, ok bool)
Done() <- chan struct{}
Err() error
Value(key interface{}) interface{}
  • Deadline: The first value is the deadline, at which point the Context will automatically trigger the Cancel action. The second value is…

Golang synchronizes multiple goroutines via channels and sync packages to prevent multiple goroutines from competing for data.

Data competition problem

Due to the data competition problem, it is necessary to synchronize multiple goroutines concurrently, so we need to understand what data competition is before that.

To understand data competition, it is necessary to mention atomic operations.

When each task executed by the computer cannot be further subdivided (it cannot be split into smaller subtasks), it is an atomic task.

Atomic operations are operations that are directly implemented by a single CPU instruction (this instruction cannot be interrupted during execution).

Usually, num = num…

The essence of IO operations is the mutual copying of user space buffers and kernel space buffers.

It generally consists of two steps:

  1. wait for network data to reach NIC (read-ready) / wait for NIC to be writable (write-ready) -> read / write to kernel buffer
  2. copy data from kernel buffer -> user space (read) / copy data from user space -> kernel buffer (write)

In Linux, the objects of IO are files (because everything is a file).
IO for normal files involves DMA, disk and CPU. For socket files sendfile technology is also included.

Synchronous IO and Asynchronous IO

From the point of view…

When the local computer communicates with GitHub, the transmission is mainly based on two protocols, HTTPS and SSH, and the corresponding repository addresses are HTTPS URLs and SSH URLs.

The first thing to emphasize is that HTTPS URLs and SSH URLs correspond to two completely independent permission verification methods. The main difference is that HTTPS URLs use account passwords for verification, and SSH URLs use SSH key pairs for verification. In normal use, we can choose one according to the actual situation.


GitHub officially recommends the use of HTTPS URLs, because this method is more applicable (even in the case…

Zion Chu

Train for gains

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store