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.

Properties

This interface does not have any properties.

Methods

FileReaderSync.readAsArrayBuffer()

This method converts a specified Blob or a File into an ArrayBuffer representing the input data as a binary string.

FileReaderSync.readAsBinaryString()

This method converts a specified Blob or a File into a DOMString 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 DOMString 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 DOMString representing the input data as a data URL.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
FileReaderSync
7
12
8
10
≤12.1
6
≤37
18
8
≤12.1
6
1.0
FileReaderSync
7
12
8
10
≤12.1
6
≤37
18
8
≤12.1
6
1.0
readAsArrayBuffer
7
12
8
10
≤12.1
6
≤37
18
8
≤12.1
6
1.0
readAsBinaryString
7
12
8
11
15
6
≤37
18
8
14
6
1.0
readAsDataURL
7
12
8
10
≤12.1
6
≤37
18
8
≤12.1
6
1.0
readAsText
7
12
8
10
≤12.1
6
≤37
18
8
≤12.1
6
1.0
worker_support
7
From Chrome 59, not supported in service workers.
12
Not supported in service workers.
8
From Firefox 61, not supported in service workers.
10
≤15
From Opera 46, not supported in service workers.
6
Not supported in service workers.
≤37
From version 59, not supported in service workers.
18
From Chrome 59, not supported in service workers.
8
From Firefox 61, not supported in service workers.
≤14
From Opera 43, not supported in service workers.
6
Not supported in service workers.
1.0
From version 7.0, not supported in service workers.

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FileReaderSync