Which JavaScript function should you use?

You develop a webpage that allows a user to download a 3PEG image and convert it to a PNG file.
You need to implement the code to download the contents of the JPEG image with no additional
decoding.
Which JavaScript function should you use?

You develop a webpage that allows a user to download a 3PEG image and convert it to a PNG file.
You need to implement the code to download the contents of the JPEG image with no additional
decoding.
Which JavaScript function should you use?

A.
readAsBinaryString()

B.
readAsArrayBuffer()

C.
readAsDataURL()

D.
readAsText()



Leave a Reply 3

Your email address will not be published. Required fields are marked *


rik

rik

Wow.
Where did this question come from? Certainly not the the 70-480 Exam-ref or the training guide… Anybody know of a link that can explain why this and not one of the others is the correct answer?

Y

Y

readAsArrayBuffer()

The readAsArrayBuffer() method will read a Blob or File object and produce an ArrayBuffer. An ArrayBuffer is a fixed-length binary data buffer. They can come in handy when manipulating files (like converting a JPEG image to PNG).

So, it’s B