Method Convert
- Namespace
- LMKit.Document.Conversion
- Assembly
- LM-Kit.NET.dll
Convert(byte[], bool, CancellationToken)
Converts an EML or Outlook MSG file (as a byte array) to Markdown.
public static string Convert(byte[] emlData, bool stripQuotes = false, CancellationToken cancellation = default)
Parameters
emlDatabyte[]The EML or Outlook MSG file content as a byte array.
stripQuotesboolWhen
true, quoted and reply content is removed from the email body.cancellationCancellationTokenA cancellation token used to cancel the conversion operation.
Returns
- string
A Markdown string representing the email content.
Examples
using LMKit.Document.Conversion;
byte[] emlBytes = File.ReadAllBytes("invoice.eml");
string markdown = EmlToMarkdown.Convert(emlBytes);
Console.WriteLine(markdown);
Exceptions
- ArgumentNullException
Thrown when
emlDataisnull.
Convert(string, bool, CancellationToken)
Converts an EML or Outlook MSG file at the specified path to Markdown.
public static string Convert(string inputPath, bool stripQuotes = false, CancellationToken cancellation = default)
Parameters
inputPathstringThe file system path to the EML or Outlook MSG file.
stripQuotesboolWhen
true, quoted and reply content is removed from the email body.cancellationCancellationTokenA cancellation token used to cancel the conversion operation.
Returns
- string
A Markdown string representing the email content.
Examples
using LMKit.Document.Conversion;
string markdown = EmlToMarkdown.Convert("message.eml");
Exceptions
- ArgumentException
Thrown when
inputPathisnullor whitespace.- FileNotFoundException
Thrown when the specified file does not exist.