主题
ShareFile
Represents a file to share, either from disk or in-memory bytes.
属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
path | Optional[str] | None | Filesystem path to the file to share. |
data | Optional[bytes] | None | Raw bytes of the file to share. |
mime_type | Optional[str] | None | MIME type of the file. |
name | Optional[str] | None | Optional name of the file. |
方法
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
from_path | 'ShareFile' | — | Create ShareFile from a filesystem path. Args: path: Filesystem path to the file. name: Optional name of the file. |
from_bytes | 'ShareFile' | — | Create ShareFile from raw bytes. Args: data: Raw bytes of the file. mime_type: Optional MIME type of the file. name: Optional name of the file. |