2
0
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:
Dmitriy Mozgovoy
2023-01-31 01:10:39 +02:00
committed by GitHub
parent 65e8d1e28c
commit 6ac574e00a
9 changed files with 303 additions and 54 deletions
+15
View File
@@ -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;