I am using Guacamole.client.createClipboardStream for creating a clipboard stream and send write the stream on paste event but, the remote clipboard is still empty.
const stream = client.createClipboardStream("text/plain");
stream.sendBlob(data);
I had the same issue, but then found that per the Guacamole Common Js spec, the OuputStream.sendBlob method expects a Base64 encoded string representing the blob.
Here's a little snippet from my quite early code to do this
const blobToBase64 = (blob) => {
return new Promise((res, _) => {
const reader = new FileReader();
reader.onloadend = () => res(reader.result);
reader.readAsDataURL(blob);
});
}
const sendBlobBasedOnMimeType = async (item, mimeType) => {
const blob = await item.getType(mimeType);
const blobAsDataUrl = await blobToBase64(blob);
const blobAsB64 = blobAsDataUrl.split(",")[1];
console.log("size of b64 blob", blobAsB64.length);
const stream = guac.current.createClipboardStream(mimeType, "remote");
stream.onack = () => {
stream.sendEnd();
}
stream.sendBlob(blobAsB64);
}