• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
2 SPDX-License-Identifier: curl
3 Long: range
4 Short: r
5 Help: Retrieve only the bytes within RANGE
6 Arg: <range>
7 Protocols: HTTP FTP SFTP FILE
8 Category: http ftp sftp file
9 Example: --range 22-44 $URL
10 Added: 4.0
11 See-also: continue-at append
12 Multi: single
13 ---
14 Retrieve a byte range (i.e. a partial document) from an HTTP/1.1, FTP or SFTP
15 server or a local FILE. Ranges can be specified in a number of ways.
16 .RS
17 .TP 10
18 .B 0-499
19 specifies the first 500 bytes
20 .TP
21 .B 500-999
22 specifies the second 500 bytes
23 .TP
24 .B -500
25 specifies the last 500 bytes
26 .TP
27 .B 9500-
28 specifies the bytes from offset 9500 and forward
29 .TP
30 .B 0-0,-1
31 specifies the first and last byte only(*)(HTTP)
32 .TP
33 .B 100-199,500-599
34 specifies two separate 100-byte ranges(*) (HTTP)
35 .RE
36 .IP
37 (*) = NOTE that this causes the server to reply with a multipart response,
38 which is returned as-is by curl! Parsing or otherwise transforming this
39 response is the responsibility of the caller.
40 
41 Only digit characters (0-9) are valid in the 'start' and 'stop' fields of the
42 'start-stop' range syntax. If a non-digit character is given in the range, the
43 server's response is unspecified, depending on the server's configuration.
44 
45 Many HTTP/1.1 servers do not have this feature enabled, so that when you
46 attempt to get a range, curl instead gets the whole document.
47 
48 FTP and SFTP range downloads only support the simple 'start-stop' syntax
49 (optionally with one of the numbers omitted). FTP use depends on the extended
50 FTP command SIZE.
51