# How MarkItDown Handles Non-Seekable Streams: Automatic Buffering for Pipes and Network Sockets

> MarkItDown automatically buffers non-seekable streams like pipes and sockets in memory. Discover how this process enables document type detection and text extraction.

- Repository: [Microsoft/markitdown](https://github.com/microsoft/markitdown)
- Tags: internals
- Published: 2026-04-11

---

**MarkItDown automatically buffers non-seekable streams in memory using `io.BytesIO`, converting pipes, network sockets, and HTTP responses into seekable objects that support document type detection and text extraction.**

The `microsoft/markitdown` library extracts Markdown text from diverse document sources. When processing **non-seekable streams**—such as Unix pipes, network sockets, or streaming HTTP responses—the library must overcome a critical limitation: document converters require random access to inspect file headers and magic numbers. The solution involves transparent in