# Save file to stream This article demonstrates how to convert a file and save it as a stream using GroupDocs.Conversion for .NET API. To save the conversion results to a stream, follow these steps: 1. Specify the method to obtain the stream where the converted file will be sent. 2. Pass the method's name as the `document` parameter to the [Convert()](https://reference.groupdocs.com/conversion/net/groupdocs.conversion/converter/convert/) method implementations. The stream provider is a `Func` that receives the whole converted document, or a `Func` that receives each converted page separately. The following code snippet shows how to save a file to a stream: ```csharp public static void Run() { Func getOutputStream = saveContext => GetFileStream($"c:\\files\\converted.{saveContext.TargetFormat.Extension}"); using (Converter converter = new Converter("c:\\files\\sample.docx")) { PdfConvertOptions options = new PdfConvertOptions(); // Pass the output stream as parameter converter.Convert(getOutputStream, options); } Console.WriteLine($"\nSource file converted successfully.\nSent file to stream."); } // Obtain the stream for the conversion output public static Stream GetFileStream(string outFile) { return new FileStream(outFile, FileMode.Create); } ``` You can also use the [ConvertTo(Func convertedStreamProvider)](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.fluent/iconversionto/convertto/#convertto) [fluent syntax]({{< ref "conversion/net/developer-guide/basic-usage/fluent-syntax.md" >}}) method to save a file to a stream: ```csharp public static void Run() { Func getOutputStream = saveContext => GetFileStream($"c:\\files\\converted.{saveContext.TargetFormat.Extension}"); FluentConverter // Specify source file location .Load("c:\\files\\sample.docx") // Pass the output stream as parameter .ConvertTo(getOutputStream) .WithOptions(new PdfConvertOptions()) .Convert(); } // Obtain the stream for the conversion output public static Stream GetFileStream(string outFile) { return new FileStream(outFile, FileMode.Create); } ```