GroupDocsGists
10/24/2017 - 7:09 AM

Examples-GroupDocs.Viewer.Examples.CSharp-GroupDocs.Viewer.Examples-Utilties-SaveAnyFile.cs

// For complete examples and data files, please go to https://github.com/groupdocsviewer/GroupDocs_Viewer_NET
//Create file stream
FileStream fileStream = File.Create(Path.Combine(Path.GetFullPath(OutputPath), filename), (int)content.Length);

// Initialize the bytes array with the stream length and then fill it with data
byte[] bytesInStream = new byte[content.Length];
content.Read(bytesInStream, 0, bytesInStream.Length);

// Use write method to write to the file specified above
fileStream.Write(bytesInStream, 0, bytesInStream.Length);