# 下载数据
<subtitle>将 Volume 中的文件下载到本地。</subtitle>

您可以使用 `read_file()` 方法从 Volume 下载数据。

```python
from ucloud_sandbox import Volume

volume = Volume.connect('volume-id')

# 以字节形式读取 Volume 中的文件
content = volume.read_file('/path/in/volume', format='bytes')
# 写入本地文件系统
with open('/local/path', 'wb') as file:
    file.write(content)
```

## 下载大文件

对于较大的文件，可以使用 `format='stream'` 分块读取，避免一次性将整个文件加载到内存中。

```python
from ucloud_sandbox import Volume

volume = Volume.connect('volume-id')

with open('/local/path', 'wb') as file:
    for chunk in volume.read_file('/path/in/volume', format='stream'):
        file.write(chunk)
```
