为什么 fetch 可以发送 ArrayBuffer 而不是 XHR caano?
Why can fetch send an ArrayBuffer but not XHR caanot?
我想知道为什么 fetch API 可以发送 ArrayBuffer 实例而 XMLHttpRequest API 不能。为什么从 XMLHttpRequest 中删除它?
我正在阅读https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Body and https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send
它似乎是 a specification simplification。他们没有提供可以发送的类型化数组列表,而是将它们全部分组在 "ArrayBufferView" 下。无论如何,您至少需要一个 DataView 来读取 ArrayBuffer,此外,如果确实需要,您始终可以访问底层的 ArrayBuffer。
我想知道为什么 fetch API 可以发送 ArrayBuffer 实例而 XMLHttpRequest API 不能。为什么从 XMLHttpRequest 中删除它?
我正在阅读https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Body and https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send
它似乎是 a specification simplification。他们没有提供可以发送的类型化数组列表,而是将它们全部分组在 "ArrayBufferView" 下。无论如何,您至少需要一个 DataView 来读取 ArrayBuffer,此外,如果确实需要,您始终可以访问底层的 ArrayBuffer。