AcTools.Utils.FileUtils.ReadAllBytesAsync C# (CSharp) Method

ReadAllBytesAsync() private method

private ReadAllBytesAsync ( string filename, CancellationToken cancellation = default(CancellationToken) ) : Task
filename string
cancellation CancellationToken
return Task
        public static async Task<byte[]> ReadAllBytesAsync(string filename, CancellationToken cancellation = default(CancellationToken)) {
            using (var stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                var result = new byte[stream.Length];
                await stream.ReadAsync(result, 0, (int)stream.Length, cancellation);
                return result;
            }
        }