mirror of https://github.com/abpframework/abp.git
8 changed files with 85 additions and 8 deletions
|
After Width: | Height: | Size: 6.7 KiB |
@ -0,0 +1,31 @@ |
|||
using System.IO; |
|||
using System.Text; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp; |
|||
|
|||
namespace Microsoft.Extensions.FileProviders |
|||
{ |
|||
public static class AbpFileInfoExtensions |
|||
{ |
|||
/// <summary>
|
|||
/// Reads file content as string using <see cref="Encoding.UTF8"/> encoding.
|
|||
/// </summary>
|
|||
public static string ReadAsString([NotNull] this IFileInfo fileInfo) |
|||
{ |
|||
return fileInfo.ReadAsString(Encoding.UTF8); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Reads file content as string using the given <paramref name="encoding"/>.
|
|||
/// </summary>
|
|||
public static string ReadAsString([NotNull] this IFileInfo fileInfo, Encoding encoding) |
|||
{ |
|||
Check.NotNull(fileInfo, nameof(fileInfo)); |
|||
|
|||
using (var stream = fileInfo.CreateReadStream()) |
|||
{ |
|||
return encoding.GetString(stream.GetAllBytes()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1 @@ |
|||
//test.js-contents
|
|||
Loading…
Reference in new issue