I'm using the Azure.Storage.Files.DataLake nuget package to write and append file on my Azure Storage account that is enabled for Data Lake Gen2 (including hierarchy).
However, I need to set the Content Type of a new file I create and I don't succeed in it, although I thought I had things written correctly. Here's my code:
public async Task<bool> WriteBytes(string fileName, byte[] recordContent, string contentType)
{
var directory = await CreateDirectoryIfNotExists();
var fileClient = await directory.CreateFileAsync(fileName,
new PathHttpHeaders
{
ContentType = contentType
})).Value;
long recordSize = recordContent.Length;
var recordStream = new MemoryStream(recordContent);
await fileClient.AppendAsync(recordStream, offset: 0);
await fileClient.FlushAsync(position: recordSize);
return true;
}
The result after the execution of the above code looks like this (the default content-type is kept):
Thanks for any insights