I am having issues understanding the proper way I am supposed to use files loaded in memory streams or memory mapped files in conjunction to methods that only accept string file paths.
Let's say I am writing a file to memory stream like this:
using (MemoryStream ms = new MemoryStream())
using (FileStream file = new FileStream("path_to_my_external_file.jpg", FileMode.Open, FileAccess.Read))
{
byte[] bytes = new byte[file.Length];
file.Read(bytes, 0, (int)file.Length);
ms.Write(bytes, 0, (int)file.Length);
}
How would I be able to use the memory stream then with a function that only accepts a string file path as a parameter like GenericFunction (string filePath)?