The --max-filesize option specifies the maximum file size:
$ curl URL --max-filesize bytes
The curl command will return a non-zero exit code if the file size exceeds the limit or a zero if the download succeeds.
Linux Shell Scripting Cookbook - Third Edition
by Shantanu Tushar
Published by
Packt Publishing, 2017
The --max-filesize option specifies the maximum file size:
$ curl URL --max-filesize bytes