MCPcopy Create free account
hub / github.com/78/tenbox / upload

Method upload

scripts/publish.py:186–196  ·  view source on GitHub ↗

Upload a file to OSS with optional progress callback(bytes_sent, total_bytes).

(self, oss_key: str, local_path: str, progress_callback=None)

Source from the content-addressed store, hash-verified

184 return f"{self.public_url}/{oss_key}"
185
186 def upload(self, oss_key: str, local_path: str, progress_callback=None):
187 """Upload a file to OSS with optional progress callback(bytes_sent, total_bytes)."""
188 if not self.available:
189 raise RuntimeError(self._init_error or "OSS 未初始化")
190 oss2.resumable_upload(
191 self.bucket, oss_key, local_path,
192 multipart_threshold=10 * 1024 * 1024,
193 part_size=2 * 1024 * 1024,
194 num_threads=4,
195 progress_callback=progress_callback,
196 )
197
198
199# ---------------------------------------------------------------------------

Callers 1

_workerFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected