Functions for encoding and decoding the InfoPath base64 format.
{
name: string, // the file's name
bytes: string, // the file's bytes, as a Uint8Array
}
{
fileName: string, // the file's name
fileExtension: string, // the file's extension, including the initial period
fileSize: number, // the actual file's size
base64: string, // the file's data in base64 format
fileExtensionWithoutPeriod, // the extension without a period
}
decodeBase64Attachment(attachmentBase64: string): AttachmentValues
Decodes the given base64 attachment value to determine its bytes and name.
If the provided base64 value is not an InfoPath attachment, returns the given base64 value's bytes and attempts to determine a placeholder filename based on the file's first new bytes.
isAttachment(base64: string): boolean
Returns true if the provided base64 value is an InfoPath attachment.
encodeBase64Attachment(fileBytes: UintArray, name: string): string
Converts the given bytes and file name to an InfoPath base64 attachment and returns the base64 value.
getAttachmentValues(attachmentBase64: string): DetailedAttachmentValues
Decodes the given base64 attachment returns an object containing a base64 string for the file's data, file name information, and size.
As with decodeBase64Attachment()
, if the provided base64 value is not an InfoPath attachent, a filename will be auto-determined and used.
arrayBufferToBase64(buffer: ArrayBuffer): string
Converts the given array buffer to a base64 string.
base64Array(base64: string, blockSize?: number): Uint8Array
Converts the given base64 value to a byte array, processing with blocks of the given size. If blockSize is unspecified, a value will be auto-determined.
base64ToText(base64: string): string
Converts the given base64 data to a text string using UTF-8 encoding.
byteArrayToBase64(bytes: Uint8Array): string
Converts the given byte array to a base64 string.
stringToUtf8Bytes(text: string): Uint8Array
Converts a text string to a byte array using UTF-8 encoding.