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

WriteAllBytesAsync() public static method

public static WriteAllBytesAsync ( [ filename, [ bytes, CancellationToken cancellation = default(CancellationToken) ) : Task
filename [
bytes [
cancellation CancellationToken
return Task
        public static async Task WriteAllBytesAsync([NotNull] string filename, [NotNull] byte[] bytes,
                CancellationToken cancellation = default(CancellationToken)) {
            if (filename == null) throw new ArgumentNullException(nameof(filename));
            if (bytes == null) throw new ArgumentNullException(nameof(bytes));

            using (var stream = File.Open(filename, FileMode.Create)) {
                await stream.WriteAsync(bytes, 0, bytes.Length, cancellation);
            }
        }