diegoles / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

Patch for decoding a base64 string to a Unit8Array. #465

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The attached patch adds decodeStringToTypedArray which decodes a base64 string 
to a Unit8Array.

The function is based on decodeStringToByteArray with two changes:
1. We need to calculate the outputLength and initialize the typed array:
var output = new Uint8Array(outputLength);
2. We need to use 
output[outputIndex] = Byte;
instead of
output.push(Byte);

I've also added Uint8Array as an optional type for 
goog.crypt.base64.encodeByteArray input param.

Thanks

Original issue reported on code.google.com by pablo.platt@gmail.com on 12 May 2012 at 2:15

Attachments:

GoogleCodeExporter commented 8 years ago
We can't take a patch without a CLA signed.

http://code.google.com/p/closure-library/wiki/Contributors

Original comment by nn...@google.com on 15 May 2012 at 10:23

GoogleCodeExporter commented 8 years ago

Original comment by chrishe...@google.com on 15 May 2012 at 10:38