readAsArrayBuffer() 方法在 FileReaderSync interface allows to read File or Blob objects in a synchronous way into an ArrayBuffer . This interface is only available in workers as it enables synchronous I/O that could potentially block.

句法

ArrayBuffer readAsArrayBuffer(
  in Blob blob
);
					

参数

blob
DOM File or Blob to read into the File or ArrayBuffer .

返回值

ArrayBuffer representing the file's data.

异常

The following exceptions can be raised by this method:

NotFoundError
is raised when the resource represented by the DOM File or Blob cannot be found, e.g. because it has been erased.
SecurityError
is raised when one of the following problematic situation is detected:
  • the resource has been modified by a third party;
  • too many read are performed simultaneously;
  • the file pointed by the resource is unsafe for a use from the Web (like it is a system file).
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 'readAsArrayBufferSync' in that specification.
工作草案 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
readAsArrayBuffer 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

图例

完整支持

完整支持

另请参阅

元数据

  • 最后修改: