Load file from stream

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Comparison MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-comparison -- dnx GroupDocs.Comparison.Mcp --yes
Folders, licensing and more →

On this page

To avoid the saving stream as a file, GroupDocs.Comparison allows you to work with file streams directly.

To work with stream, follow these steps:

  1. Obtain file stream.
  2. Pass opened source file stream to the Comparer class constructor or pass opened target file stream to the Add method.

The following code snippet shows how to load file from stream:

using GroupDocs.Comparison;
using System.IO;
// ...

using (Stream sourceStream = File.OpenRead("source.docx"))
using (Stream targetStream = File.OpenRead("target.docx"))
{
    using (Comparer comparer = new Comparer(sourceStream))
    {
        comparer.Add(targetStream);
        comparer.Compare(File.Create("result.docx"));
    }
}

See also

On this page