Skip to content

ShareFile

Represents a file to share, either from disk or in-memory bytes.

属性 ​

名称类型默认值说明
pathOptional[str]NoneFilesystem path to the file to share.
dataOptional[bytes]NoneRaw bytes of the file to share.
mime_typeOptional[str]NoneMIME type of the file.
nameOptional[str]NoneOptional 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.

关注我,学习大模型、大数据、Python等热门技术。