mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
feat(fomdata): added support for spec-compliant FormData & Blob types; (#5316)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
const {asyncIterator} = Symbol;
|
||||
|
||||
const readBlob = async function* (blob) {
|
||||
if (blob.stream) {
|
||||
yield* blob.stream()
|
||||
} else if (blob.arrayBuffer) {
|
||||
yield await blob.arrayBuffer()
|
||||
} else if (blob[asyncIterator]) {
|
||||
yield* asyncIterator.call(blob);
|
||||
} else {
|
||||
yield blob;
|
||||
}
|
||||
}
|
||||
|
||||
export default readBlob;
|
||||
Reference in New Issue
Block a user