Add GetAllBytesAsync to AbpFormFileExtensions

This makes it easier to get an array of bytes directly from an `IFormFile`
pull/3116/head
zHaytam 5 years ago
parent 48e38d4d84
commit 84b7e85d48

@ -1,4 +1,5 @@
using System.IO;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Http
{
@ -11,5 +12,11 @@ namespace Microsoft.AspNetCore.Http
return stream.GetAllBytes();
}
}
public static async Task<byte[]> GetAllBytesAsync(this IFormFile file)
{
using var stream = file.OpenReadStream();
return await stream.GetAllBytesAsync();
}
}
}

Loading…
Cancel
Save