Skip to content

Instantly share code, notes, and snippets.

View mlschneid's full-sized avatar

Mike Schneider mlschneid

View GitHub Profile
static async Task<byte[]> ReadBytesAsync(string filePath)
{
byte[] buffer;
using(FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
buffer = new byte[fs.Length];
if (fs.Length < Int32.MaxValue)
{
await fs.ReadAsync(buffer, 0, (int)fs.Length);
}