Base64Attachment
Namespace: Signal.Bot
Full Name: Signal.Bot.Base64Attachment
Summary
Represents a base64-encoded attachment with support for various input formats including raw base64, bytes, files, and data URIs.
Properties
Value
Gets the base64-encoded string representation of the attachment, optionally including data URI metadata.
Methods
FromBase64
FromBase64(base64Data)Creates a Base64Attachment from a raw base64-encoded string.
Parameters:
base64Data- The base64-encoded string.
Returns: A new Base64Attachment instance.
FromBytes
FromBytes(bytes)Creates a Base64Attachment from a byte array.
Parameters:
bytes- The byte array to encode.
Returns: A new Base64Attachment instance.
FromDataUri
FromDataUri(base64Data, mimeType)Creates a Base64Attachment as a data URI from base64-encoded data and a MIME type.
Parameters:
base64Data- The base64-encoded string.mimeType- The MIME type of the data (e.g., "image/png").
Returns: A new Base64Attachment instance with data URI format.
FromDataUri
FromDataUri(bytes, mimeType)Creates a Base64Attachment as a data URI from a byte array and a MIME type.
Parameters:
bytes- The byte array to encode.mimeType- The MIME type of the data (e.g., "image/png").
Returns: A new Base64Attachment instance with data URI format.
FromDataUri
FromDataUri(base64Data, mimeType, filename)Creates a Base64Attachment as a data URI from base64-encoded data, MIME type, and filename.
Parameters:
base64Data- The base64-encoded string.mimeType- The MIME type of the data (e.g., "image/png").filename- The filename to include in the data URI.
Returns: A new Base64Attachment instance with data URI format including filename.
FromDataUri
FromDataUri(bytes, mimeType, filename)Creates a Base64Attachment as a data URI from a byte array, MIME type, and filename.
Parameters:
bytes- The byte array to encode.mimeType- The MIME type of the data (e.g., "image/png").filename- The filename to include in the data URI.
Returns: A new Base64Attachment instance with data URI format including filename.
FromFile
FromFile(filePath, mimeType, includeFilename)Creates a Base64Attachment from a file path, automatically detecting the MIME type from the file extension.
Parameters:
filePath- The path to the file to encode.mimeType- Optional MIME type override. If null, the MIME type is inferred from the file extension.includeFilename- If true, includes the filename in the data URI.
Returns: A new Base64Attachment instance with data URI format.
op_Implicit
op_Implicit(attachment)Implicitly converts a Base64Attachment to its string representation.
Parameters:
attachment- The attachment to convert.
ToString
ToString()Returns the base64-encoded string representation of the attachment.
Returns: The Value property.
