(source: Pick<Blob, 'arrayBuffer' | 'bytes'>)
| 4 | * Prefers the newer `.bytes` method when available as it more efficient but not widely supported yet. |
| 5 | */ |
| 6 | export function readAsBuffer(source: Pick<Blob, 'arrayBuffer' | 'bytes'>): Promise<ArrayBuffer | Uint8Array> { |
| 7 | if (typeof source.bytes === 'function') { |
| 8 | // eslint-disable-next-line ban/ban |
| 9 | return source.bytes() |
| 10 | } |
| 11 | |
| 12 | return (source as Pick<Blob, 'arrayBuffer'>).arrayBuffer() |
| 13 | } |
no test coverage detected