You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by Nikolay Ganchev <vo...@abv.bg> on 2024/10/04 14:45:05 UTC

Download file from VM

We have a custom client, but we use most of the features from the guacamole java client and we fully reuse the guacd server. We already have a file upload, from the user to the VM in the session, this is simple, however I could not find if there is a way to download files from the VM via the guacamole protocol, can anyone point me towards a solution, if someone has done something similar?
Thanks

Re: Download file from VM

Posted by Michael Jumper <mj...@apache.org>.
On 10/4/24 7:45 AM, Nikolay Ganchev wrote:
> We have a custom client, but we use most of the features from the 
> guacamole java client and we fully reuse the guacd server. We already 
> have a file upload, from the user to the VM in the session, this is 
> simple, however I could not find if there is a way to download files 
> from the VM via the guacamole protocol, can anyone point me towards a 
> solution, if someone has done something similar?

You need to handle the inbound file stream by providing an "onfile" handler:

https://guacamole.apache.org/doc/guacamole-common-js/Guacamole.Client.html#event:onfile

You can then deal with the received data as you see fit. There are 
mechanisms available in JavaScript for client-side assembly and download 
of files using Blob objects and similar:

https://w3c.github.io/FileAPI/

There are reader implementations that make consuming the stream easier 
depending on the type of data that would be most convenient, for example:

https://guacamole.apache.org/doc/guacamole-common-js/Guacamole.BlobReader.html

The alternative to doing that would be to assemble and stream the file 
server-side by intercepting and handling the instructions that otherwise 
would have been sent to the user. This is what we do in the mainline 
Guacamole webapp. If you want to go that route, the main things to look 
at for intercepting specific instructions is the filtering functionality 
provided by guacamole-common:

https://guacamole.apache.org/doc/guacamole-common/org/apache/guacamole/protocol/FilteredGuacamoleSocket.html

https://guacamole.apache.org/doc/guacamole-common/org/apache/guacamole/protocol/FilteredGuacamoleReader.html

- Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@guacamole.apache.org
For additional commands, e-mail: user-help@guacamole.apache.org