Download Command¶
The download command downloads files with optional hash verification.
Basic Download¶
Hash Verification¶
Verify the file hash after download:
Supported hash algorithms:
sha256sha512
Size Verification¶
Verify file size after download:
Timeout¶
Set download timeout (default: 300 seconds):
API Usage¶
import asyncio
from porringer.api import API
from porringer.schema import LocalConfiguration, DownloadParameters
api = API(LocalConfiguration())
params = DownloadParameters(
url='https://example.com/file.zip',
destination=Path('./file.zip'),
expected_hash='sha256:abc123...',
)
result = asyncio.run(api.download(params))
print(f'Download success: {result.success}')
Progress Callback¶
For programmatic usage, you can provide a progress callback: