Sample Header Ad - 728x90

Speeding up curl in bash scripts

0 votes
1 answer
160 views
I'm using a Bash script to retrieve the Spotify album thumbnail from whatever I'm listening at the moment to show it as an image in Hyprlock. For this particular case, I'm using the command curl to retrieve the album cover image and store it in a separate directory.
-sh
...
if [ ! -f "stored_file.jpg" ]; then
     curl $url -so stored_file.jpg
     echo "stored_file.jpg"
...
The thing is, whenever this condition is met, curl downloads the image, but it causes a lag spike, affecting all of the other widgets I implemented, which is not ideal. I wanted to know if there was a way to optimize curl, or use another similar command to download the image from the URL without having any performance issues. What I've already just managed to do is limit the use of curl as much as possible to not have lag constantly. But it doesn't help that it lags everything else so frequently.
Asked by ItsFireStorm (1 rep)
Dec 13, 2024, 10:11 AM
Last activity: Jul 11, 2025, 04:27 AM