(
file: File,
options: { maxBytes: number; label: string }
)
| 308 | } |
| 309 | |
| 310 | export async function readFileToBufferWithLimit( |
| 311 | file: File, |
| 312 | options: { maxBytes: number; label: string } |
| 313 | ): Promise<Buffer> { |
| 314 | assertKnownSizeWithinLimit(file.size, options.maxBytes, options.label) |
| 315 | const buffer = Buffer.from(await file.arrayBuffer()) |
| 316 | assertKnownSizeWithinLimit(buffer.byteLength, options.maxBytes, options.label) |
| 317 | return buffer |
| 318 | } |
| 319 | |
| 320 | export async function consumeOrCancelBody( |
| 321 | response: { body?: ReadableStream<Uint8Array> | null }, |
no test coverage detected