5 stars based on
The result property contains the file contents on success and error contains error information about the failed operation. You can use the same basic setup for reading to a data URI. Data URIs sometimes called data URLs are an interesting option if you want to, for example, display an image that was just read from disk.
This code loads the image data into a new Image object and then uses that to draw the image onto a canvas specifying both the width and height as Data URIs are generally used for this purpose, but can be used on any type of the file. The most common use case for reading a file into a data URI is to display the file contents on a web page immediately. An ArrayBuffer represents a finite number of bytes that may be used to store numbers of any size.
Additional Information Support my work on Patreon and get free stuff! Subscribe by Email Enter your email address: