xref: /aosp_15_r20/external/curl/docs/cmdline-opts/max-filesize.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerLong: max-filesize
5*6236dae4SAndroid Build Coastguard WorkerArg: <bytes>
6*6236dae4SAndroid Build Coastguard WorkerHelp: Maximum file size to download
7*6236dae4SAndroid Build Coastguard WorkerProtocols: FTP HTTP MQTT
8*6236dae4SAndroid Build Coastguard WorkerCategory: connection
9*6236dae4SAndroid Build Coastguard WorkerAdded: 7.10.8
10*6236dae4SAndroid Build Coastguard WorkerMulti: single
11*6236dae4SAndroid Build Coastguard WorkerSee-also:
12*6236dae4SAndroid Build Coastguard Worker  - limit-rate
13*6236dae4SAndroid Build Coastguard WorkerExample:
14*6236dae4SAndroid Build Coastguard Worker  - --max-filesize 100K $URL
15*6236dae4SAndroid Build Coastguard Worker---
16*6236dae4SAndroid Build Coastguard Worker
17*6236dae4SAndroid Build Coastguard Worker# `--max-filesize`
18*6236dae4SAndroid Build Coastguard Worker
19*6236dae4SAndroid Build Coastguard WorkerWhen set to a non-zero value, it specifies the maximum size (in bytes) of a
20*6236dae4SAndroid Build Coastguard Workerfile to download. If the file requested is larger than this value, the
21*6236dae4SAndroid Build Coastguard Workertransfer does not start and curl returns with exit code 63.
22*6236dae4SAndroid Build Coastguard Worker
23*6236dae4SAndroid Build Coastguard WorkerSetting the maximum value to zero disables the limit.
24*6236dae4SAndroid Build Coastguard Worker
25*6236dae4SAndroid Build Coastguard WorkerA size modifier may be used. For example, Appending 'k' or 'K' counts the
26*6236dae4SAndroid Build Coastguard Workernumber as kilobytes, 'm' or 'M' makes it megabytes, while 'g' or 'G' makes it
27*6236dae4SAndroid Build Coastguard Workergigabytes. Examples: 200K, 3m and 1G. (Added in 7.58.0)
28*6236dae4SAndroid Build Coastguard Worker
29*6236dae4SAndroid Build Coastguard Worker**NOTE**: before curl 8.4.0, when the file size is not known prior to
30*6236dae4SAndroid Build Coastguard Workerdownload, for such files this option has no effect even if the file transfer
31*6236dae4SAndroid Build Coastguard Workerends up being larger than this given limit.
32*6236dae4SAndroid Build Coastguard Worker
33*6236dae4SAndroid Build Coastguard WorkerStarting with curl 8.4.0, this option aborts the transfer if it reaches the
34*6236dae4SAndroid Build Coastguard Workerthreshold during transfer.
35