MCPcopy Create free account
hub / github.com/AstrBotDevs/AstrBot / to_base64

Method to_base64

astrbot/core/utils/media_utils.py:161–163  ·  view source on GitHub ↗

Read the resolved local file and return raw base64 data.

(self)

Source from the content-addressed store, hash-verified

159 return self.path.read_bytes()
160
161 def to_base64(self) -> str:
162 """Read the resolved local file and return raw base64 data."""
163 return base64.b64encode(self.read_bytes()).decode("utf-8")
164
165 def to_data_url(self) -> str:
166 """Read the resolved local file and return a data URL."""

Callers 1

to_data_urlMethod · 0.95

Calls 2

read_bytesMethod · 0.95
decodeMethod · 0.80

Tested by

no test coverage detected