---
Product: Aspose.Email
Platform: python
Page Type: reference
Canonical URL: https://reference.aspose.org/email/python/cfbwriter
---

# CFBWriter

## Overview

`CFBWriter` is a class in Aspose.Email FOSS for Python.

Deterministic serializer for Compound File Binary (CFB) containers.

This class provides 2 methods for working with CFBWriter objects in Python programs.
Available methods include: `to_bytes`, `write_file`.
All public members are accessible to any Python application after installing the Aspose.Email FOSS for Python package.

## Methods

| Signature | Description |
|-----------|-------------|
| `to_bytes(document: CFBDocument)` → `bytes` | Serializes the given CFBDocument into a bytes object |
| `write_file(document: CFBDocument, path: Path \| str)` | Writes the serialized CFBDocument to the specified file path |

## Examples

```python
from aspose.email_foss.cfb import CFBDocument, CFBWriter

doc = CFBDocument.from_file("input.cfb")
CFBWriter.write_file(doc, "output.cfb")
data = CFBWriter.to_bytes(doc)
```

## See Also

- [Aspose.Email for Python — Enterprise API Reference](https://reference.aspose.com/email/python-net/)