弃用
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the
兼容性表格
at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
注意:
This method is deprecated in favor of
readAsArrayBuffer()
.
readAsBinaryString()
方法在
FileReaderSync
interface allows to read
File
or
Blob
objects in a synchronous way into an
DOMString
. This interface is
only available
in
workers
as it enables synchronous I/O that could potentially block.
readAsBinaryString(File); readAsBinaryString(Blob);
DOMString
representing the input data.
The following exceptions can be raised by this method:
NotFoundError
File
or
Blob
cannot be found, e.g. because it has been erased.
SecurityError
NotReadableError
is raised when the resource cannot be read due to a permission problem, like a concurrent lock.
EncodingError
is raised when the resource is a data URL and exceed the limit length defined by each browser.
| 规范 | 状态 | 注释 |
|---|---|---|
|
文件 API
The definition of 'readAsBinaryStringSync' in that specification. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
readAsBinaryString
|
Chrome Yes | Edge 12 | Firefox 8 | IE Yes | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android 8 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
完整支持
FileReaderSync