FileReaderSync: FileReaderSync() constructor
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Note: This feature is only available in Web Workers, except for Service Workers.
The FileReaderSync() constructor creates a new FileReaderSync.
Syntax
js
new FileReaderSync()
Parameters
None.
Examples
The following code snippet shows creation of a FileReaderSync object using the FileReaderSync() constructor and subsequent usage of the object:
js
function readFile(blob) {
const reader = new FileReaderSync();
postMessage(reader.readAsDataURL(blob));
}
Note:
This snippet must be used inside a Worker, as synchronous interfaces can't be used on the main thread.
Specifications
| Specification |
|---|
| File API # filereadersyncConstrctr |
Browser compatibility
| desktop | mobile | server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FileReaderSync() constructor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support