xref: /curl/docs/cmdline-opts/max-filesize.md (revision 2494b8dd)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: max-filesize
5Arg: <bytes>
6Help: Maximum file size to download
7Protocols: FTP HTTP MQTT
8Category: connection
9Added: 7.10.8
10Multi: single
11See-also:
12  - limit-rate
13Example:
14  - --max-filesize 100K $URL
15---
16
17# `--max-filesize`
18
19Specify the maximum size (in bytes) of a file to download. If the file
20requested is larger than this value, the transfer does not start and curl
21returns with exit code 63.
22
23A size modifier may be used. For example, Appending 'k' or 'K' counts the
24number as kilobytes, 'm' or 'M' makes it megabytes, while 'g' or 'G' makes it
25gigabytes. Examples: 200K, 3m and 1G. (Added in 7.58.0)
26
27**NOTE**: before curl 8.4.0, when the file size is not known prior to
28download, for such files this option has no effect even if the file transfer
29ends up being larger than this given limit.
30
31Starting with curl 8.4.0, this option aborts the transfer if it reaches the
32threshold during transfer.
33