Fix object download to file (#105)

The ObjectContent::to_file() function was not working properly,
as it could not write in a temporary file (created with tokio::fs::File::open(),
which opens a file in read-only mode).

To solve this issue, modified the way temporary files are opened to be
able to write inside of it.

* Add an example to download a file

This new example demonstrates how to download an object and store its
content into a file.

---------

Co-authored-by: Henk-Jan Lebbink <henkjan.lebbink@gmail.com>
Co-authored-by: Jean Sainctavit <jean.sainctavit@qarnot-computing.com>
This commit is contained in:
jeasai
2025-01-23 23:42:40 +01:00
committed by GitHub
parent 0438f044ff
commit 26d67b80df
4 changed files with 95 additions and 11 deletions

View File

@@ -63,5 +63,8 @@ quickcheck = "1.0.3"
[[example]]
name = "file_uploader"
[[example]]
name = "file_downloader"
[[example]]
name = "object_prompt"