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 interface allows to read File or Blob objects synchronously. This interface is only available in workers as it enables synchronous I/O that could potentially block.
FileReaderSync()Returns a new FileReaderSync object.
This interface does not have any properties.
FileReaderSync.readAsArrayBuffer()This method converts a specified Blob or a File into an ArrayBuffer representing the input data as a binary string.
FileReaderSync.readAsBinaryString() Deprecated
This method converts a specified Blob or a File into a string representing the input data as a binary string. This method is deprecated, consider using readAsArrayBuffer() instead.
FileReaderSync.readAsText()This method converts a specified Blob or a File into a string representing the input data as a text string. The optional encoding 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 a File into a string representing the input data as a data URL.
| Specification |
|---|
| File API> # FileReaderSync> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
FileReaderSync |
7 | 12 | 8 | ≤12.1 | 6 | 18 | 8 | ≤12.1 | 6 | 1.0 | 4.4 | 6 |
FileReaderSync |
7 | 12 | 8 | ≤12.1 | 6 | 18 | 8 | ≤12.1 | 6 | 1.0 | 4.4 | 6 |
readAsArrayBuffer |
9 | 12 | 8 | ≤12.1 | 6 | 18 | 8 | ≤12.1 | 6 | 1.0 | 4.4 | 6 |
readAsBinaryString |
7 | 12 | 8 | 15 | 6 | 18 | 8 | 14 | 6 | 1.0 | 4.4 | 6 |
readAsDataURL |
7 | 12 | 8 | ≤12.1 | 6 | 18 | 8 | ≤12.1 | 6 | 1.0 | 4.4 | 6 |
readAsText |
7 | 12 | 8 | ≤12.1 | 6 | 18 | 8 | ≤12.1 | 6 | 1.0 | 4.4 | 6 |
worker_support |
7 | 12 | 8 | ≤15 | 6 | 18 | 8 | ≤14 | 6 | 1.0 | 4.4 | 6 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FileReaderSync