nolanlawson/blob-util

Unnecessary conversion for blobToArrayBuffer

sheerun opened this issue · 2 comments

Hello. Thanks for creating this library!

I'd like to use it, but one thing bothers me: why in blobToArrayBuffer you first convert blobToBinaryString and then binaryStringToArrayBuffer?

FileReader can always readAsArrayBuffer, so you don't need to even allocate binary string representation.

Am I missing something?

I don't believe readAsArrayBuffer is supported in IE; I'd have to check.

But yeah, you're right; if new FileReader().readAsArrayBuffer is defined, then we should use that instead of the current method. Good catch! :)

Fixed as of v1.1.2