> I'm reading the code of Guacamole for the purpose of learning , and I want to 
> know why  chose Base64 to encode image data. As far as I know, it will 
> enlarge the total size of data transmission over network. Why not just send 
> binary data? I have read the official document, and it said:

Mike or James can probably answer this better, but I think there are two 
reasons:- We're not just transmitting the binary data (the image, for example), 
we also need to transmit metadata about the binary data, and we want the 
metadata to arrive at the same time as the binary data.  So, we encode it all 
in a stream and send it all at the same time, then decode it on the other end, 
and we get the binary data (the actual object) along with the information we 
need about the object.- We're transmitting the data over HTTP, which, in a lot 
of situations, is picky about the characters it deals with.  Since we're not 
just transmitting binary data the browser is used to dealing with (image, 
video, text), but we're transmitting the metadata, as well, we have to package 
it up in a way the browser can handle, decode, and then use the metadata and 
translate the binary data.  Base64 is allows us to do this with a character set 
that can be transmitted over HTTP.
-Nick   

Reply via email to