arrayBuffer()
方法在
Blob
interface returns a
Promise
that resolves with the contents of the blob as binary data contained in an
ArrayBuffer
.
var bufferPromise = blob.arrayBuffer(); blob.arrayBuffer().then(buffer => /* process the ArrayBuffer */); var buffer = await blob.arrayBuffer();
None.
A promise that resolves with an
ArrayBuffer
that contains the blob's data in binary form.
While this method doesn't throw exceptions, it may reject the promise. This can happen, for example, if the reader used to fetch the blob's data throws an exception. Any exceptions thrown while getting the data will be converted into rejections.
While similar to the
FileReader.readAsArrayBuffer()
方法,
arrayBuffer()
returns a promise rather than being an event-based API, as is the case with the
FileReader
interface's method.
| 规范 | 状态 | 注释 |
|---|---|---|
|
文件 API
The definition of 'Blob.arrayBuffer()' in that specification. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
arrayBuffer()
|
Chrome 76 | Edge 79 | Firefox 69 | IE No | Opera No | Safari No | WebView Android 76 | Chrome Android 76 | Firefox Android No | Opera Android 54 | Safari iOS No | Samsung Internet Android 12.0 |
完整支持
不支持