Hello S.,
sorry for the really late reply! Just cleaning up my mailbox, and that was
forgotten.
S. Sara [2019-10-21 15:52 +0000]:
I am working on a cockpit plugin. Among some features, I would like
to be able to upload some heavy binary files (# 500MB) to remote machines through cockpit
web page.
Do you have some advices on how to do this ?
https://github.com/cockpit-project/cockpit/issues/12338 has some details about
this. Indeed this needs documentation and some refinement (Stef recently made
the chunking better), but at least with spawning a process like dd, having that
write the output file, and feeding blocks into it with .input() seems like a
workable solution for now.
It of course would be better if the cockpit.file() API would support sending
the contents in multiple chunks, but cockpit.js doesn't currently do that.
However, the *protocol* [1] does allow it. I. e. you can open a raw channel [2]
with the payload="fsreplace1" type, and feed the data using channel.send() in
multiple blocks. I'm not aware of an existing example there, but that's IMHO
the most elegant and efficient way.
Thanks,
Martin
[1]
https://github.com/cockpit-project/cockpit/blob/master/doc/protocol.md#pa...
[2]
https://cockpit-project.org/guide/latest/cockpit-channels.html