I have this code:
public async Task CreateFileAsync(string filePath, byte[] bytes)
{
using (var sourceStream = System.IO.File.Open(filePath, FileMode.OpenOrCreate))
{
sourceStream.Seek(0, SeekOrigin.End);
await sourceStream.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
}
}
I want to write it on F#, I get as far as this before I can't figure out what to do:
module myModule
open System.IO;
let CreateFileAsync (filePath: string, bytes : byte[]) =
use sourceStream = File.Open(filePath, FileMode.OpenOrCreate)
|> sourceStream.Seek(0, SeekOrigin.End);
I have searched around but there are a couple of concepts here and I can't put them all together.