You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Prowlarr/src/NzbDrone.Common/Extensions/StreamExtensions.cs

24 lines
595 B

using System.IO;
using System.Threading.Tasks;
namespace NzbDrone.Common.Extensions
{
public static class StreamExtensions
{
public static async Task<byte[]> ToBytes(this Stream input)
{
var buffer = new byte[16 * 1024];
using (var ms = new MemoryStream())
{
int read;
while ((read = await input.ReadAsync(buffer, 0, buffer.Length)) > 0)
{
await ms.WriteAsync(buffer, 0, read);
}
return ms.ToArray();
}
}
}
}