DataUrlAppendFileTo(StringBuilder, String, String, DataEncoding) Method

Appends the content of a file as "data" URL (RFC 2397) to the end of a StringBuilder.

Definition

Namespace: FolkerKinzel.DataUrls
Assembly: FolkerKinzel.DataUrls (in FolkerKinzel.DataUrls.dll) Version: 1.0.0+b1c843815044ca6fd87a144c9ff16386002c6473
C#
public static StringBuilder AppendFileTo(
	StringBuilder builder,
	string filePath,
	string? mimeType = null,
	DataEncoding encoding = DataEncoding.Base64
)

Parameters

builder  StringBuilder
The StringBuilder to which a "data" URL is appended.
filePath  String
Abolute path to the file whose content is to embed in the "data" URL.
mimeType  String  (Optional)
The Internet Media Type ("MIME type") of the file whose content is to embed, or null to let the method automatically retrieve the MimeType from the file type extension.
encoding  DataEncoding  (Optional)
The encoding to use to embed the file content.

Return Value

StringBuilder
A reference to builder.

Exceptions

ArgumentNullExceptionbuilder or filePath is null.
ArgumentExceptionfilePath is not a valid file path.
IOExceptionI/O error.

See Also