I have an Azure Function v2 with c#.net core code running on dedicated App Service Plan. The function downloads files and then uploads them via Microsoft Graph to a Sharepoint Library.
My code looks like this
var path = System.IO.Path.GetTempPath() + downloadedfileName;
using (var stream = System.IO.File.Create(path)
{
//put content from downloaded file into stream
//call graph to use the stream and upload the content.
}
This code works fine, but I am concerned about running out of temp space. The question I have is:
- When will this temp file get cleared
- If it is not cleared automatically then how do i clear it?
- Is there any other alternative way to handle this upload scenario?