运行 读读

对象对象

storage.run({ action: "object", key })

某个物体的内容,作为文字或基数64——由其中实际内容而不是由它的名称决定。

object storagefreelossless
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

await storage.run({ action: "object", key: "invoices/2026/01/a.pdf" });
// { key, size, contentType, base64: "…" }

await storage.run({ action: "object", key: "notes/today.md" });
// { key, size, contentType, text: "# Today…" }
storage.run(action="object", key="invoices/2026/01/a.pdf")
# {"key", "size", "contentType", "base64": "…"}

storage.run(action="object", key="notes/today.md")
# {"key", "size", "contentType", "text": "# Today…"}

文本或基数64

你得到触发条件
文字文字文字文字内容类型为文字, 字节不包含空字节 。
基数64任何其他的。

两个字段都从未同时存在,所以测试是哪一个存在。

const object = await storage.run({ action: "object", key });

const bytes = object.text !== undefined
  ? Buffer.from(object.text, "utf8")
  : Buffer.from(object.base64, "base64");

await fs.writeFile(local, bytes);
import base64
from pathlib import Path

obj = storage.run(action="object", key=key)

data = obj["text"].encode("utf-8") if "text" in obj else base64.b64decode(obj["base64"])

Path(local).write_bytes(data)
内容决定, 而不是延期

名为.dat 的文本文件作为文本出现,这是正确的答案——读成基数64 将是一个没有的编码, 失去一次往返。

全文全文为:

没有区域。 检查 size 调自 列表中 双方的字节都通过记忆。

const page = await storage.run({ action: "list", prefix });
const target = page.objects.find((o) => o.key === key);

if (target.size > 25 * 1024 * 1024) throw new Error("too large to read in one call");
page = storage.run(action="list", prefix=prefix)
target = next(o for o in page["objects"] if o["key"] == key)

if target["size"] > 25 * 1024 * 1024:
    raise ValueError("too large to read in one call")