I'm streaming data from a file upload a la javascript FileReader - parsing long file in chunks in browser javascript.
Basically its reading a file in chunks by doing:
var r = new FileReader()
var blob = file.slice(curPosition, curPosition+chunkSize);
r.onload = function(e) {
emit('data', e.target.result)
}
r.readAsDataURL(blob)
It does this as many times as necessary to read the whole file.
But when I do this, I get the data-url preamble each time, then a bunch of base64 data. Even when I remove the preamble, simple string concatenation doesn't work (the file ends up corrupted).
How can you concatenate two data urls? Or really, I think this question boils down to: how do you concatenate two base64 strings?
Alternatively, how do you build a data url in pure javascript?