Load from a 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.Metadata 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-metadata -- dnx GroupDocs.Metadata.Mcp --yes
Folders, licensing and more →

This example demonstrates how to load a file from a binary stream. Pass any readable binary file-like object (an open(..., "rb") handle or an io.BytesIO) to the Metadata constructor.

from groupdocs.metadata import Metadata


def load_from_stream():
    with open("input.docx", "rb") as stream:
        with Metadata(stream) as metadata:
            # Extract, edit or remove metadata here
            print(f"Loaded {metadata.file_format} from a stream")


if __name__ == "__main__":
    load_from_stream()

input.docx is the sample file used in this example. Click here to download it.

Loaded 3 from a stream

Download full output

See also

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document metadata management App

You are welcome to view and edit metadata of PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, emails, images and more with our free online Free Online Document Metadata Viewing and Editing App.