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