> For the complete documentation index, see [llms.txt](https://docs.swanchain.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.swanchain.io/bulders/app-developer/store-and-retrieve-a-file-with-swan-storage/4.retrieve-and-download-files.md).

# 4.Retrieve and Download Files

### 4.1 List files in a bucket

Get a list of file information from one of your buckets

```python
from swan_mcs import APIClient, BucketAPI
mcs_api = APIClient("<API_KEY>")
bucket_client = BucketAPI(mcs_api)

for i in bucket_client.list_files("<BUCKET_NAME>", '<PREFIX>', "<LIMIT>", '<OFFSET>'):
    print(i.to_json())
```

### 4.2 Get file information

Get the file information of a file in one of your buckets

```python
from swan_mcs import APIClient, BucketAPI
mcs_api = APIClient("<API_KEY>")
bucket_client = BucketAPI(mcs_api)

print(bucket_client.get_file("<BUCKET_NAME>", "<OBJECT_NAME>").to_json())
```

**Parameters**

* **bucket\_name**: The name of the bucket
* **object\_name:** The object name of the file

### 4.3 Download a file

Downloads the file (located using `bucket_name`/`object_name` from IPFS and writes it to `local_filename`

```python
from swan_mcs import APIClient, BucketAPI
mcs_api = APIClient("<API_KEY>")
bucket_client = BucketAPI(mcs_api)

bucket_client.download_file("<BUCKET_NAME>", "<OBJECT_NAME>", "<LOCAL_FILENAME>")
```

**Parameters**

* **bucket\_name**: The name of the bucket
* **object\_name:** The object name to download
* **local\_filename:** The download destination and filename
