public static IObservable <HttpFetch <string> > Text(this IHttpObservable query, Encoding encoding) => query.ReadContent(async f => { using (var stream = await f.Content.ReadAsStreamAsync().DontContinueOnCapturedContext()) using (var reader = new StreamReader(stream, encoding)) return(await reader.ReadToEndAsync().DontContinueOnCapturedContext()); });
public static IObservable <HttpFetch <T> > WithReader <T>(this IHttpObservable query, Func <HttpFetch <HttpContent>, Task <T> > reader) => query.ReadContent(reader);
public static IObservable <HttpFetch <HttpContent> > Buffer(this IHttpObservable query) => query.ReadContent(async f => { await f.Content.LoadIntoBufferAsync().DontContinueOnCapturedContext(); return(f.Content); });
public static IObservable <HttpFetch <string> > Text(this IHttpObservable query) => query.ReadContent(f => f.Content.ReadAsStringAsync());
public static IObservable <HttpFetch <LocalFileContent> > DownloadTemp(this IHttpObservable query, string path) => query.ReadContent(f => DownloadTemp(f, path));