58 lines
1.5 KiB
Markdown
Raw Normal View History

2024-05-15 15:20:32 -04:00
---
2023-12-11 20:30:44 -05:00
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Long: range
Short: r
Help: Retrieve only the bytes within RANGE
Arg: <range>
Protocols: HTTP FTP SFTP FILE
Category: http ftp sftp file
Added: 4.0
Multi: single
2024-05-15 15:20:32 -04:00
See-also:
- continue-at
- append
Example:
- --range 22-44 $URL
2023-12-11 20:30:44 -05:00
---
2024-05-15 15:20:32 -04:00
# `--range`
2023-12-11 20:30:44 -05:00
Retrieve a byte range (i.e. a partial document) from an HTTP/1.1, FTP or SFTP
server or a local FILE. Ranges can be specified in a number of ways.
2024-05-15 15:20:32 -04:00
## 0-499
2023-12-11 20:30:44 -05:00
specifies the first 500 bytes
2024-05-15 15:20:32 -04:00
## 500-999
2023-12-11 20:30:44 -05:00
specifies the second 500 bytes
2024-05-15 15:20:32 -04:00
## -500
2023-12-11 20:30:44 -05:00
specifies the last 500 bytes
2024-05-15 15:20:32 -04:00
## 9500-
2023-12-11 20:30:44 -05:00
specifies the bytes from offset 9500 and forward
2024-05-15 15:20:32 -04:00
## 0-0,-1
2023-12-11 20:30:44 -05:00
specifies the first and last byte only(*)(HTTP)
2024-05-15 15:20:32 -04:00
## 100-199,500-599
2023-12-11 20:30:44 -05:00
specifies two separate 100-byte ranges(*) (HTTP)
2024-05-15 15:20:32 -04:00
##
(*) = NOTE that these make the server reply with a multipart response, which
is returned as-is by curl! Parsing or otherwise transforming this response is
the responsibility of the caller.
2023-12-11 20:30:44 -05:00
Only digit characters (0-9) are valid in the 'start' and 'stop' fields of the
'start-stop' range syntax. If a non-digit character is given in the range, the
server's response is unspecified, depending on the server's configuration.
Many HTTP/1.1 servers do not have this feature enabled, so that when you
attempt to get a range, curl instead gets the whole document.
FTP and SFTP range downloads only support the simple 'start-stop' syntax
(optionally with one of the numbers omitted). FTP use depends on the extended
FTP command SIZE.