feat: Show download progress (#399)

This commit is contained in:
Kroese 2024-01-29 04:51:59 +01:00 committed by GitHub
parent a69c13e61b
commit fca0a71976
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,8 +22,11 @@ fi
while true while true
do do
if [ -f "$file" ]; then if [ -f "$file" ]; then
size=$(stat -c '%s' "$file" | numfmt --to=si --suffix=B) bytes=$(du -sb "$file" | cut -f1)
echo "${body//(\[P\])/($size)}"> "$info" if (( bytes > 1000 )); then
size=$(echo "$bytes" | numfmt --to=si --suffix=B | sed -r 's/([A-Z])/ \1/')
echo "${body//(\[P\])/($size)}"> "$info"
fi
fi fi
sleep 1 sleep 1
done done