(value)
| 69447 | if (!options.type) { |
| 69448 | const type2 = bits[0]?.type; |
| 69449 | if (typeof type2 === "string") { |
| 69450 | options = { ...options, type: type2 }; |
| 69451 | } |
| 69452 | } |
| 69453 | return new File2(bits, name, options); |
| 69454 | } |
| 69455 | async function getBytes(value) { |
| 69456 | let parts = []; |
| 69457 | if (typeof value === "string" || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc. |
| 69458 | value instanceof ArrayBuffer) { |
| 69459 | parts.push(value); |
| 69460 | } else if (isBlobLike(value)) { |
| 69461 | parts.push(await value.arrayBuffer()); |
| 69462 | } else if (isAsyncIterableIterator(value)) { |
| 69463 | for await (const chunk of value) { |
| 69464 | parts.push(chunk); |
| 69465 | } |
| 69466 | } else { |
| 69467 | throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`); |
no test coverage detected
searching dependent graphs…