curl: add long option '--out-null'

Add a new commandline option --out-null that discards all
response bytes into the void. Replaces non-portable use of
'-o /dev/null' with more efficiency.

Feature added in 8.16.0

Closes #17800
This commit is contained in:
Stefan Eissing 2025-07-02 09:43:13 +02:00 committed by Daniel Stenberg
parent 0e49234128
commit 6845533e24
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
13 changed files with 137 additions and 6 deletions

View file

@ -181,6 +181,7 @@ DPAGES = \
ntlm.md \
oauth2-bearer.md \
output-dir.md \
out-null.md \
output.md \
parallel-immediate.md \
parallel-max.md \

View file

@ -0,0 +1,26 @@
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Long: out-null
Help: Discard response data into the void
Category: output
Added: 8.16.0
Multi: per-URL
See-also:
- output
- remote-name
- remote-name-all
- remote-header-name
Example:
- "https://example.com" --out-null
---
# `--out-null`
Discard all response output of a transfer silently. This is the more
efficient and portable version of
curl https://host.example -o /dev/null
The transfer is done in full, all data is received and checked, but
the bytes are not written anywhere.

View file

@ -9,6 +9,7 @@ Category: important output
Added: 4.0
Multi: per-URL
See-also:
- out-null
- remote-name
- remote-name-all
- remote-header-name
@ -56,6 +57,10 @@ Or for Windows:
curl example.com -o nul
Or, even more efficient and portable, use
curl example.com --out-null
Specify the filename as single minus to force the output to stdout, to
override curl's internal binary output in terminal prevention:

View file

@ -145,6 +145,7 @@
--ntlm 7.10.6
--ntlm-wb 7.22.0
--oauth2-bearer 7.33.0
--out-null 8.16.0
--output (-o) 4.0
--output-dir 7.73.0
--parallel (-Z) 7.66.0