mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
23 lines
654 B
C#
23 lines
654 B
C#
|
|
// Copyright (c) Microsoft Corporation
|
|||
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|||
|
|
// See the LICENSE file in the project root for more information.
|
|||
|
|
|
|||
|
|
using System.IO;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace Peek.FilePreviewer.Previewers
|
|||
|
|
{
|
|||
|
|
public static class ReadHelper
|
|||
|
|
{
|
|||
|
|
public static async Task<string> Read(string path)
|
|||
|
|
{
|
|||
|
|
using var fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
|||
|
|
using var sr = new StreamReader(fs, Encoding.UTF8);
|
|||
|
|
|
|||
|
|
string content = await sr.ReadToEndAsync();
|
|||
|
|
return content;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|