计算机是一个存储器,其数据是其文件,并且它们就呆在原地。这就是整个想法:一个在机器上工作的代理阅读它所打开的磁盘,而不是复制的磁盘。
const pc = await api.storage.get({ id: machineId });
await pc.files.list(); // what is in the workspace
await pc.files.write("notes/today.md", "…"); // write
await pc.files.read("notes/today.md"); // read back
await pc.files.mkdir("notes/archive");
await pc.files.move("notes/today.md", "notes/archive/today.md");
await pc.files.remove("notes/archive/today.md");pc = api.storage.get(id=machine_id)
pc.files.list() # what is in the workspace
pc.files.write("notes/today.md", "…") # write
pc.files.read("notes/today.md") # read back
pc.files.mkdir("notes/archive")
pc.files.move("notes/today.md", "notes/archive/today.md")
pc.files.remove("notes/archive/today.md")签名全名在 本地文件.
这些文件存放在哪里
在那台机器的办公空间下 SDK用户主目录中的自定义文件夹。您通过路径是相对的,路径不能离开它。
他们没有被清算,也没有被清算;
服务器上没有这种东西能接触到任何服务器,这也是为什么将电脑存到 api.files 被拒了 如果机器走了,他们也会
其它东西都扔在身上
| storage.type | 得到什么 |
|---|---|
| 文件系统 | 本地文件 。 |
| 电话电话 | storage_is_phone - 其文件在浏览器里 |
| · 目标 · 浏览器 | storage_not_local - 使用运行 () 。 |
两种不同拒绝的目的:一种是说“储存错误 ” ,另一种是说“正确的想法,错误的问处 ” 。 手机的档案存在;可以从持有这些档案的页面上找到。
import { IaGenifyError } from "iagenify";
function filesOf(storage) {
try {
return storage.files;
} catch (err) {
if (err instanceof IaGenifyError && err.code === "storage_is_phone") {
return null; // reachable through the page, not from here
}
if (err instanceof IaGenifyError && err.code === "storage_not_local") {
return null; // its data is read through run()
}
throw err;
}
}def files_of(storage):
# None on a phone (reachable through the page, not from here)
# and on any storage that is not a computer (its data is read through run()).
return storage.files这是机器的档案 不是任何机器的
是从这里找到另一台电脑的档案 读了这个
存取器在您所在的进程中工作。 持有机器连接系统不会给您提供远程文件系统 — 检查机器Id 来对抗您在操作前实际使用的机器 。
代理商用这个做什么
代理人将计算机作为 machine 读取并写出精确的这个。 这就是为什么它的工具被允许按类别而不是按文件来使用: 边界是工作空间, 并且决定由您来决定 。