Class FileExtensions
- Namespace
- NuvTools.Storage
- Assembly
- NuvTools.Storage.dll
Provides extension methods for converting file content between different formats.
public static class FileExtensions
- Inheritance
-
FileExtensions
- Inherited Members
Methods
Base64StringFromContent(IFile)
Converts a stream to a Base64-encoded string.
public static string? Base64StringFromContent(this IFile value)
Parameters
valueIFileThe file containing the stream to convert.
Returns
- string
A Base64-encoded string representing the stream content, or
nullif the stream is null.
Exceptions
- ArgumentNullException
Thrown when
valueis null.
ContentFromBase64String(IFile)
Converts a Base64-encoded string to a stream.
public static Stream? ContentFromBase64String(this IFile value)
Parameters
valueIFileThe file containing the Base64 string to convert.
Returns
- Stream
A MemoryStream containing the decoded bytes, or
nullif the Base64 string is null or empty.
Exceptions
- ArgumentNullException
Thrown when
valueis null.