/// <summary> /// Copies the specified file segment to the given response stream. /// This calls StartAsync if it has not previously been called. /// </summary> /// <param name="path">The full disk path to the file.</param> /// <param name="offset">The offset in the file to start at.</param> /// <param name="count">The number of bytes to send, or null to send the remainder of the file.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> used to abort the transmission.</param> /// <returns></returns> public virtual async Task SendFileAsync(string path, long offset, long?count, CancellationToken cancellationToken) { if (!_started) { await StartAsync(cancellationToken); } await SendFileFallback.SendFileAsync(Stream, path, offset, count, cancellationToken); }
public Task SendFileAsync(string path, long offset, long?count, CancellationToken cancellation) { OnWrite(); if (_compressionStream != null) { return(SendFileFallback.SendFileAsync(Stream, path, offset, count, cancellation)); } return(_innerBodyFeature.SendFileAsync(path, offset, count, cancellation)); }
public Task SendFileAsync(string path, long offset, long?count, CancellationToken cancellationToken) { Initialize(); if (_minificationEnabled || _compressionEnabled) { return(SendFileFallback.SendFileAsync(Stream, path, offset, count, cancellationToken)); } return(_responseBodyFeature.SendFileAsync(path, offset, count, cancellationToken)); }
Task IHttpResponseBodyFeature.SendFileAsync(string path, long offset, long?length, CancellationToken cancellation) { var writer = ((IHttpResponseBodyFeature)this).Writer; return(SendFileFallback.SendFileAsync(writer.AsStream(), path, offset, length, cancellation)); }