Use this skill when downloading files from HTTP/HTTPS URLs, especially large files (>100MB).
Typical scenarios:
Trigger keywords:
curl -C - for resumable downloads--progress-bar flagbash
exec(
command="curl -L -C - --progress-bar -o <destination_path> <URL>",
background=true,
timeout=600
)
Parameter explanation:
-L - Follow redirects-C - - Resume partial download--progress-bar - Show progress bar-o - Output file pathbackground=true - Critical! Run in background to avoid timeouttimeout=600 - 10 minutes timeout (adjust based on file size)bash
process(action="poll", sessionId="<session_id>")
Poll periodically to check download progress until completion.
bash
exec(command="ls -lh <file_path>")
Check:
User: "Download https://github.com/example/app/releases/download/v1.0/app.dmg"
Agent action:
json
{
"tool": "exec",
"command": "curl -L -C - --progress-bar -o ~/Downloads/app.dmg https://github.com/example/app/releases/download/v1.0/app.dmg",
"background": true,
"timeout": 600
}
Returns: {status: "running", sessionId: "xxx"}
Then poll periodically:
json
{
"tool": "process",
"action": "poll",
"sessionId": "xxx"
}
After download completes, verify:
json
{
"tool": "exec",
"command": "ls -lh ~/Downloads/app.dmg && file ~/Downloads/app.dmg"
}
For small files, simplified handling is acceptable:
bash
exec(command="curl -L -o ~/Downloads/small.pdf https://example.com/small.pdf", timeout=120)
Small files can run synchronously, but still set timeout.
File SizeRecommended Timeout< 50MB120 seconds (2 min)50-200MB300 seconds (5 min)200-500MB600 seconds (10 min)500MB-1GB1200 seconds (20 min)> 1GB1800 seconds (30 min) or more
1. Download interrupted
bash
# Re-run same command, curl -C - will resume automatically
curl -L -C - --progress-bar -o file.zip <URL>
2. Permission denied
bash
# Ensure destination directory is writable
mkdir -p ~/Downloads
3. Redirect failed
bash
# Use -L flag to follow redirects
curl -L -o file.zip <URL>
4. Network timeout
bash
# Increase timeout or use --retry
curl -L --retry 3 --connect-timeout 30 -o file.zip <URL>
If aria2 is available, use multi-threading for faster downloads:
bash
exec(
command="aria2c -x 16 -s 16 -k 1M --continue -o ~/Downloads/file.zip <URL>",
background=true,
timeout=600
)
bash
# 1. Start download
exec(command="curl -L -C - --progress-bar -o ~/Downloads/file.zip <URL>", background=true, timeout=600)
# 2. Poll every 30 seconds
process(action="poll", sessionId="xxx")
# 3. Verify after completion
exec(command="ls -lh ~/Downloads/file.zip")
# 4. Optional: Calculate checksum
exec(command="md5sum ~/Downloads/file.zip")
file command to verifyfeishu-send-file - Send downloaded file to Feishufile-read - Read downloaded file contentvideo-frames - Extract frames if video fileIf download fails, follow these steps:
Check network connectivity bash
curl -I <URL>
Check disk space bash
df -h ~/Downloads
View detailed error bash
curl -v -o /dev/null <URL>
Try alternative tool bash
wget --continue <URL>
Remember: Always use background=true for large file downloads! 🎯