Download to a File
Stream decrypted bytes directly to disk instead of buffering in memory.
rust
use sia_storage::DownloadOptions;
let mut file = tokio::fs::File::create("output.bin").await?;
sdk.download(&mut file, &obj, DownloadOptions::default()).await?;go
file, err := os.Create("output.bin")
if err != nil {
panic(err)
}
defer file.Close()
if err := client.Download(ctx, file, obj); err != nil {
panic(err)
}python
with open("output.bin", "wb") as file:
await sdk.download(file, obj, DownloadOptions())