
public interface FileReaderSync
The FileReaderSync interface allows to read File or Blob objects in a synchronous way.
This interface is only available in workers as it enables synchronous I/O that could potentially block.
| Modifier and Type | Method and Description |
|---|---|
ArrayBuffer |
readAsArrayBuffer(Blob blob)
|
String |
readAsBinaryString(Blob blob)
|
String |
readAsDataURL(Blob blob)
|
String |
readAsText(Blob blob)
This methods reads the specified blob's contents.
|
String |
readAsText(Blob blob,
String encoding)
This methods reads the specified blob's contents.
|
ArrayBuffer readAsArrayBuffer(Blob blob)
This method reads the contents of the specified Blob or File. When the read operation is finished, it returns an ArrayBuffer representing the file's data. If an error happened during the read, the adequate exception is sent.
blobBlob or File to read into the ArrayBuffer.An ArrayBuffer representing the file's data.
The following exceptions can be raised by this method:
NotFoundErrorBlob or File cannot be found, e. g. because it has been erased.SecurityErrorNotReadableErrorEncodingErrorString readAsBinaryString(Blob blob)
This method reads the contents of the specified Blob, which may be a File. When the read operation is finished, it returns a DOMString containing the raw binary data from the file. If an error happened during the read, the adequate exception is sent.
readAsArrayBuffer() should be used instead.A DOMString containing the raw binary data from the resource
The following exceptions can be raised by this method:
NotFoundErrorBlob or File cannot be found, e. g. because it has been erased.SecurityErrorNotReadableErrorEncodingErrorString readAsDataURL(Blob blob)
This method reads the contents of the specified Blob or File. When the read operation is finished, it returns a data URL representing the file's data. If an error happened during the read, the adequate exception is sent.
An DOMString representing the file's data as a data URL.
The following exceptions can be raised by this method:
NotFoundErrorBlob or File cannot be found, e. g. because it has been erased.SecurityErrorNotReadableErrorEncodingErrorString readAsText(Blob blob)
This methods reads the specified blob's contents. When the read operation is finished, it returns a DOMString containing the file represented as a text string. The optional encoding parameter indicates the encoding to be used. If not present, the method will apply a detection algorithm for it. If an error happened during the read, the adequate exception is sent.
A DOMString containing the raw binary data from the resource
The following exceptions can be raised by this method:
NotFoundErrorBlob or File cannot be found, e. g. because it has been erased.SecurityErrorNotReadableErrorString readAsText(Blob blob, String encoding)
This methods reads the specified blob's contents. When the read operation is finished, it returns a DOMString containing the file represented as a text string. The optional encoding parameter indicates the encoding to be used. If not present, the method will apply a detection algorithm for it. If an error happened during the read, the adequate exception is sent.
A DOMString containing the raw binary data from the resource
The following exceptions can be raised by this method:
NotFoundErrorBlob or File cannot be found, e. g. because it has been erased.SecurityErrorNotReadableErrorCopyright © 2016. All rights reserved.