( bytes: Uint8Array, hint: OperationFileHint, contentType: string | null | undefined, )
| 526 | }; |
| 527 | |
| 528 | const fileFromBinaryBytes = ( |
| 529 | bytes: Uint8Array, |
| 530 | hint: OperationFileHint, |
| 531 | contentType: string | null | undefined, |
| 532 | ): ToolFileValue => { |
| 533 | const hintedMimeType = contentType ?? readHintMimeType(hint, "application/octet-stream"); |
| 534 | return { |
| 535 | _tag: "ToolFile", |
| 536 | mimeType: isGenericMimeType(hintedMimeType) |
| 537 | ? (sniffMimeType(bytes) ?? hintedMimeType) |
| 538 | : hintedMimeType, |
| 539 | encoding: "base64", |
| 540 | data: bytesToBase64(bytes), |
| 541 | byteLength: bytes.byteLength, |
| 542 | }; |
| 543 | }; |
| 544 | |
| 545 | type FormDataRecord = Parameters<typeof HttpClientRequest.bodyFormDataRecord>[1]; |
| 546 | type FormDataCoercible = FormDataRecord[string]; |
no test coverage detected