FileReaderSync
The FileReaderSync
interface allows to read File
or Blob
objects synchronously.
Note: This feature is available in Web Workers
Warning: This interface is only available in workers as it enables synchronous I/O that could potentially block.
Constructor
FileReaderSync()
-
Returns a new
FileReaderSync
object.
Instance properties
This interface does not have any properties.
Instance methods
FileReaderSync.readAsArrayBuffer()
-
This method converts a specified
Blob
or aFile
into anArrayBuffer
representing the input data as a binary string. FileReaderSync.readAsBinaryString()
Deprecated-
This method converts a specified
Blob
or aFile
into a string representing the input data as a binary string. This method is deprecated, consider usingreadAsArrayBuffer()
instead. FileReaderSync.readAsText()
-
This method converts a specified
Blob
or aFile
into a string representing the input data as a text string. The optionalencoding
parameter indicates the encoding to be used (e.g., iso-8859-1 or UTF-8). If not present, the method will apply a detection algorithm for it. FileReaderSync.readAsDataURL()
-
This method converts a specified
Blob
or aFile
into a string representing the input data as a data URL.
Specifications
Specification |
---|
File API # FileReaderSync |
Browser compatibility
BCD tables only load in the browser