mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-28 11:28:27 +01:00
moved the http server to common, added more http handlers
This commit is contained in:
parent
572103cdfe
commit
5f5f2838b1
19
MediaBrowser.Common/Net/StreamExtensions.cs
Normal file
19
MediaBrowser.Common/Net/StreamExtensions.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
namespace MediaBrowser.Common.Net
|
||||
{
|
||||
public static class StreamExtensions
|
||||
{
|
||||
public static IObservable<byte[]> ReadBytes(this Stream stream, int count)
|
||||
{
|
||||
var buffer = new byte[count];
|
||||
return Observable.FromAsyncPattern((cb, state) => stream.BeginRead(buffer, 0, count, cb, state), ar =>
|
||||
{
|
||||
stream.EndRead(ar);
|
||||
return buffer;
|
||||
})();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user