Re: [whatwg] BinaryEncoding for Typed Arrays using window.btoa and window.atob

On 8/7/2013 5:28 AM, Anne van Kesteren wrote:
> On Tue, Aug 6, 2013 at 9:48 PM, Chang Shu <cshu01@gmail.com> wrote:
>> But it appears to me we have to introduce
>> another pair of coders, say BinaryDecoder/BinaryEncoder, in addition
>> to TextDecoder/TextEncode since the signatures of the decode/encode
>> functions are different.
> So TextDecoder is bytes to string and TextEncoder is string to bytes.
> If we always represent the base64-variant as a sequence of bytes the
> signature seems fine. If you want to get a string out of those bytes
> again you could utf-8 decode it for instance.
>
> I'd be interested in knowing what the level of interest is outside of
> Google for this feature.

There are enough places in my code where being able to decode/encode 
base64 from a typed array is a necessary step that I added helper 
functions to do this locally, particularly when I am about to shove it 
through charset conversion as well. Eliminating a copy step would be 
useful, although I don't think I'm pushing enough data through this 
functions to make a noticeable performance difference.

-- 
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth E

Received on Wednesday, 7 August 2013 12:47:19 UTC