Download File with Size Limit in Golang
It’s a common case to download a file with full size, but what if we want to download only the first few bytes of the file? For example if we want to check the file header or to check the file existence.
Should we download file to buffer and copy it to local disk by counting bytes? No, Go offers a super easy function to handle this, io.Copy().