Kann genutzt werden um eine als Bytearray im Datenbanksystem gelagerte Datei zu extrahieren.
Public Function GetTempFileFromBytes(ByVal Filename As String, ByVal data As Byte()) As FileInfo
Dim tempFile As New System.IO.FileInfo(My.Computer.FileSystem.GetTempFileName)
Dim tempPath As String = tempFile.DirectoryName
Dim fileInfo As New FileInfo(Path.Combine(tempPath, Filename))
Using fileStream As New System.IO.FileStream(fileInfo.FullName, FileMode.Create, FileAccess.Write)
Dim b As Byte() = DirectCast(data, Byte())
fileStream.Write(b, 0, b.Length)
fileStream.Close()
End Using
Return fileInfo
End Function
Kommentare zum Snippet