---
Product: Aspose.Email
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/email/net/cfb-reader
---

# CfbReader

## Overview

`CfbReader` is a low-level, read-only parser for Compound File Binary files. Construct it via `FromFile` or `FromStream`, then navigate the directory tree with `IterStorages`, `IterStreams`, `IterChildren`, and `FindChildByName`. Use `GetStreamData` to read raw bytes from a named stream. Implements `IDisposable`; always use it inside a `using` block to release file handles.

## Constructors

| Signature | Description |
|-----------|-------------|
| `CfbReader(data: byte[])` | Creates a new `CfbReader` with the specified parameters. |

## Methods

| Signature | Description |
|-----------|-------------|
| `FromFile(path: string)` | Opens the CFB file at `path` and returns a new `CfbReader`. |
| `FromStream(stream: Stream)` | Reads a CFB file from `stream` and returns a new `CfbReader`. |
| `Dispose()` | Releases any file handle or stream held by this reader. |
| `GetEntry(streamId: uint)` | Returns the `DirectoryEntry` for the given `streamId`. |
| `GetStreamData(streamId: uint)` | Returns the raw byte content of the stream identified by `streamId`. |
| `IterStorages()` | Yields all storage-type directory entries in tree order. |
| `IterStreams()` | Yields all stream-type directory entries in tree order. |
| `IterChildren(storageStreamId: uint)` | Yields direct child entries of the storage identified by `storageStreamId`. |
| `IterTree(startStreamId: uint)` | Yields all entries in the subtree rooted at `startStreamId` (depth-first). |
| `FindChildByName(storageStreamId: uint, name: string)` | Returns the stream ID of the direct child of `storageStreamId` whose name equals `name`, or null if not found. |
| `ResolvePath(names: IEnumerable<string>, startStreamId: uint)` | Walks a sequence of `names` starting from `startStreamId` and returns the stream ID of the final entry. |

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Header` | `Header` | Read | The parsed CFB file header; exposes sector-size fields. |
| `Difat` | `ReadOnlyCollection<uint>` | Read | Read-only view of the DIFAT sector chain. |
| `Fat` | `ReadOnlyCollection<uint>` | Read | Read-only view of the FAT (file allocation table) sector chain. |
| `MiniFat` | `ReadOnlyCollection<uint>` | Read | Read-only view of the FAT (file allocation table) sector chain. |
| `DirectoryEntries` | `ReadOnlyCollection<DirectoryEntry>` | Read | All 128-byte directory entries parsed from the directory sectors, in raw order. |
| `RootEntry` | `DirectoryEntry` | Read | The root directory entry (stream ID 0). |
| `MiniStream` | `byte[]` | Read | Raw bytes of the mini-stream container (the data stream of the root entry). |
| `MajorVersion` | `int` | Read | CFB major version parsed from the file header. |
| `SectorSize` | `int` | Read | Sector size in bytes (512 for v3, 4096 for v4). |
| `MiniSectorSize` | `int` | Read | Sector size in bytes (512 for v3, 4096 for v4). |
| `DirectoryEntryCount` | `int` | Read | Total number of directory entry records in the directory sectors. |
| `MaterializedStreamCount` | `int` | Read | Number of streams with non-empty data in the parsed document. |
| `FileSize` | `int` | Read | Total size of the source file or stream in bytes. |

## See Also
- [Aspose.Email for .NET — Enterprise API Reference](https://reference.aspose.com/email/net/)