DataUrlFromFile(String, MimeTypeInfo, DataEncoding) Method

Embeds the content of a file in a "data" URL (RFC 2397).

Definition

Namespace: FolkerKinzel.DataUrls
Assembly: FolkerKinzel.DataUrls (in FolkerKinzel.DataUrls.dll) Version: 1.0.0+b1c843815044ca6fd87a144c9ff16386002c6473
C#
public static string FromFile(
	string filePath,
	 in MimeTypeInfo mimeType,
	DataEncoding encoding = DataEncoding.Base64
)

Parameters

filePath  String
Path to the file whose content is to embed in the "data" URL.
mimeType  MimeTypeInfo
The Internet media Type ("MIME type") of the file whose content is to embed.
encoding  DataEncoding  (Optional)
The encoding to use to embed the file content.

Return Value

String
A "data" URL into which the content of the file provided by the parameter filePath is embedded.

Exceptions

ArgumentNullExceptionfilePath or mimeType is null.
ArgumentException

filePath is not a valid file path

- or -

mimeType is an empty struct.

IOExceptionI/O error.

See Also