< Summary - Jellyfin

Information
Class: MediaBrowser.Model.IO.AsyncFile
Assembly: MediaBrowser.Model
File(s): /srv/git/jellyfin/MediaBrowser.Model/IO/AsyncFile.cs
Line coverage
7%
Covered lines: 1
Uncovered lines: 12
Coverable lines: 13
Total lines: 45
Line coverage: 7.6%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ReadOptions()100%210%
get_WriteOptions()100%210%
OpenRead(...)100%11100%
OpenWrite(...)100%210%

File(s)

/srv/git/jellyfin/MediaBrowser.Model/IO/AsyncFile.cs

#LineLine coverage
 1using System.IO;
 2
 3namespace MediaBrowser.Model.IO
 4{
 5    /// <summary>
 6    /// Helper class to create async <see cref="FileStream" />s.
 7    /// </summary>
 8    public static class AsyncFile
 9    {
 10        /// <summary>
 11        /// Gets the default <see cref="FileStreamOptions"/> for reading files async.
 12        /// </summary>
 013        public static FileStreamOptions ReadOptions => new FileStreamOptions()
 014        {
 015            Options = FileOptions.Asynchronous
 016        };
 17
 18        /// <summary>
 19        /// Gets the default <see cref="FileStreamOptions"/> for writing files async.
 20        /// </summary>
 021        public static FileStreamOptions WriteOptions => new FileStreamOptions()
 022        {
 023            Mode = FileMode.OpenOrCreate,
 024            Access = FileAccess.Write,
 025            Share = FileShare.None,
 026            Options = FileOptions.Asynchronous
 027        };
 28
 29        /// <summary>
 30        /// Opens an existing file for reading.
 31        /// </summary>
 32        /// <param name="path">The file to be opened for reading.</param>
 33        /// <returns>A read-only <see cref="FileStream" /> on the specified path.</returns>
 34        public static FileStream OpenRead(string path)
 635            => new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, IODefaults.FileStreamBufferSize, Fil
 36
 37        /// <summary>
 38        /// Opens an existing file for writing.
 39        /// </summary>
 40        /// <param name="path">The file to be opened for writing.</param>
 41        /// <returns>An unshared <see cref="FileStream" /> object on the specified path with Write access.</returns>
 42        public static FileStream OpenWrite(string path)
 043            => new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None, IODefaults.FileStreamBuffer
 44    }
 45}