コード例 #1
0
        public static async Task _SendFileContents(this HttpResponse h, FileBase file, long offset, long?count, string contentsType = Consts.MimeTypes.OctetStream, CancellationToken cancel = default)
        {
            CheckStreamRange(offset, count, file.Size);

            using (FileStream srcStream = file.GetStream(false))
            {
                if (offset > 0)
                {
                    srcStream.Seek(offset, SeekOrigin.Begin);
                }

                await h._SendStreamContents(srcStream, count, contentsType, cancel);
            }
        }