Golang serving resume able file downloads with net/http

30 March, 2020

Here is a fully commented example golang function on how to serve and transmit files to clients with the go net/http package. It supports the "Accept-Ranges" header, which allows for downloads to be paused or interrupted and resumed later on. This is very useful for clients who don't have stable connections to download larger files. However this function does not support Multipart downloads, if you wish to have that functionality check this function in the net/http source code for implementation.

This function is written with the following sources RFC 7233 section 3.1MDN Range Requests and Content Range.

Home