This could be used:
curl -r 0-40000 -o 40k.raw https://www.keycdn.com/support/byte-range-requests/
the -r
stands for range:
From the curl man page:
r, --range <range>
(HTTP FTP SFTP FILE) Retrieve a byte range (i.e a partial document) from a HTTP/1.1, FTP or SFTP server or a local FILE. Ranges can be
specified in a number of ways.
0-499 specifies the first 500 bytes
500-999 specifies the second 500 bytes
-500 specifies the last 500 bytes
9500- specifies the bytes from offset 9500 and forward
0-0,-1 specifies the first and last byte only(*)(HTTP)
More info can be found in this article: https://www.keycdn.com/support/byte-range-requests/
Just in case this is a basic example of how to doit with go
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
)
func main() {
response, err := http.Get("https://google.com")
if err != nil {
log.Fatal(err)
}
defer response.Body.Close()
data, err := ioutil.ReadAll(io.LimitReader(response.Body, 40000))
fmt.Printf("data = %s\n", data)
}