Skip to content

How are we supposed to use MsgUiSendFileToDownload?

Hey there!
I tried using the new Messagetype MsgUiSendFileToDownload to push a file from the container to the GUI.
I'v used following approaches to get it working, but unfortunately it's not working:

Commit1:

self.send_message(MsgUiSendFileToDownload(fields=[{"name": "results.zip", "type": "data", "value": None}]))

Result:
just a broken file (qwq)

Commit2:

self.send_message(MsgUiSendFileToDownload(fields=[{"name": "resulewfewfts.zip", "type": "data", "value": None}]))

Result:
just a broken file v2 (but atleast I know that the file is "touch(ed)" and then "sent?" to the GUI)
(will omit "just a broken file")

Commit3:

self.send_message(MsgUiSendFileToDownload(fields=[{"name": "/root/test/results.zip", "type": "data", "value": None}]))

Result:
nothing - abs path won't change the outcome...

Commit4:

self.send_message(MsgUiSendFileToDownload(fields=[{"name": "results.zip", "type": "data", "value": "results.zip"}]))

Result: value + rel path = None

Commit5:

with zipfile.ZipFile("results.zip", "r") as resultzip:
    self.send_message(MsgUiSendFileToDownload(fields=[{"name": "results.zip", "type": "data", "value": resultzip}]))

Result:
value + filepointer = None

Commit6:

with zipfile.ZipFile("results.zip", "r") as resultzip:
    self.send_message(MsgUiSendFileToDownload(fields=[{"name": "results.zip", "type": "data", "value": resultzip.read()}]))

Result:
value + fp.read() = None

The Question is:
Could you maybe provide a snippet that'll show how to use this new message?

Edited by Chika Ngwu