Can I convert a Stream object to a FileInfo object?

asp.net-mvc, c#

Solution

Adding the following constructor to ExcelPackage makes it possible to use Streams instead.

public ExcelPackage( Stream stream ) {
    _package = Package.Open( stream, FileMode.Create, FileAccess.ReadWrite );

    Uri uriDefaultContentType = new Uri( "/default.xml", UriKind.Relative );
    PackagePart partTemp = _package.CreatePart( uriDefaultContentType, "application/xml" );

    XmlDocument workbook = Workbook.WorkbookXml; 

    _package.CreateRelationship( Workbook.WorkbookUri, TargetMode.Internal, schemaRelationships + "/officeDocument" );

    _package.DeletePart( uriDefaultContentType );
}

Problem

For the ExcelPackage constructor you need a FileInfo object. I rather use some kind of stream object(f.i. MemoryStream), because I don't need to save the file to the server itself, but expose it as a FileStream anyway to the user. I don't want to make files which I have to delete lateron from servers which are only there for generating purposes and never used again. Apart from that, otherwise I need also the necessary rights for the application/user on the directory/file on the server. So my question is then: How can I convert a stream object to a FileInfo object.

Original source