This is my code :
[StorageAccount("BlobConnectionString")]
public class copyBlobtoazureStorage
{
[FunctionName("copyBlobtoazureStorage")]
public async Task Run(
[BlobTrigger("input-file/{name}")] Stream inputBlob,
[Blob("output-file/{name}", FileAccess.Write)] Stream outputBlob,
string name, ILogger log, ExecutionContext context)
{
if (name.EndsWith(".xml"))
{
XmlDocument doc = new XmlDocument();
using (XmlReader reader = XmlReader.Create(inputBlob))
{
doc.Load(reader);
}
string jsonText = JsonConvert.SerializeXmlNode(doc);
byte[] info = new UTF8Encoding(true).GetBytes(jsonText);
outputBlob.Write(info, 0, info.Length);
}
log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {inputBlob.Length} Bytes");
}
}
I want to change the xml file in the input file to text file in output file. I tried to use {name}.txt but I got note.xml.txt but I just want note.txt ! any suggestion ?