BLOB javascript object in Xojo


Via an API, I get a Variant that contains a BLOB javascript object.

This BLOB contains a PDF, I know in advance its MIME type and its size.

How to get the content of this PDF in a String?

Thank you

Is it maybe a base64 encoded data block?

Thank you Christian. In the Xojo debugging console, the variable has the value [object blob].

I’ll keep looking.

But I found another solution, using the FilReader object (javascript) on the client side (web browser) to send a string variable to Xojo.

That means you’re passing the object from Javascript rather than its contents. Look at JSON.stringify or use the applicable property of the object you’re attempting to send.

Thank you Anthony! I tried, but the string returned is an empty object. However, the blob is a valid JS blob, with its size and type properties. There doesn’t seem to be any property of type blob.value.

But using the fileReader to read the blob, it’s ok:

[code]var reader = new FileReader();

reader.onload = function(event){
//sending the result (reader.result) to Xojo with Xojo.triggerServerEvent