It does seem reasonable to have toDataURL() and fromDataURL() in the TypedArray base class, like Canvas 2D has. I'm not sure why we haven't discussed it before.
I like this suggestion:
// binary -> base64 JS string:
mybuf.toDataURL() // "data:application/octet-stream;base64,AwEEAQUJAgY="
// base64 JS string --> arraybuf:
... but it's unclear to me how you might use this approach for getting UTF-8 data embedded in an ArrayBuffer back out to a JS string.Â
This inspired me to look again at the File API draftÂhttp://dev.w3.org/2006/webapi/FileAPI
Âsince the Blob type therein is a more direct match for something which should consume/produce data URIs. It doesÂtemptingly offer similar services, but the usage of those for these scenarios seems limited and convoluted: e.g. pull the content down as a Blob via XHR, read it (asynchronously) via a BlobReader as an ArrayBuffer via readAsArrayBuffer(); on receipt, parse it, determine the subrange which is e.g. a UTF-8 string, construct another BlobReader on it and read it (async again!) using readAsText(subblob, "UTF-8").Â