import { LoonFSClient } from "@loonfs/sdk/server";
const client = new LoonFSClient({
environment: "https://your-loonfs-host.example",
token: "YOUR_TOKEN",
});
const actor = { id: "agent", kind: "service" as const };
for (const file of files) {
const target = `/deal-room/${file.name}`;
await client.files.upload({
namespace_id: "acme",
path: target,
bytes: new Uint8Array(await file.arrayBuffer()),
actor,
commit_id: crypto.randomUUID(),
});
}
renderUploads(files);
import { LoonFS, LoonFSClient } from "@loonfs/sdk/server";
const client = new LoonFSClient({
environment: "https://your-loonfs-host.example",
token: "YOUR_TOKEN",
});
const actor = { id: "agent", kind: "service" as const };
const operations: LoonFS.FilesystemOperation[] = [
{ kind: "create_directory", path: "/deal-room/reports" },
{ kind: "create_directory", path: "/deal-room/contracts" },
{ kind: "move_path", from_path: "/deal-room/q4.md", to_path: "/deal-room/reports/q4.md" },
{ kind: "move_path", from_path: "/deal-room/q3.md", to_path: "/deal-room/reports/q3.md" },
{ kind: "move_path", from_path: "/deal-room/nda.pdf", to_path: "/deal-room/contracts/nda.pdf" },
];
await client.commits.create({
namespace_id: "acme",
actor,
commit_id: crypto.randomUUID(),
operations,
message: "Organize deal room",
});
const page = await client.files.list({
namespace_id: "acme",
path: "/deal-room",
});
import { LoonFSClient } from "@loonfs/sdk/server";
const client = new LoonFSClient({
environment: "https://your-loonfs-host.example",
token: "YOUR_TOKEN",
});
const scope = "/deal-room";
const results = await client.files.grep({
namespace_id: "acme",
pattern: "revenue",
path_prefix: scope,
});
render(results.data);
renderCount(results.data.length);
console.log(results.data[0]?.path);
import { LoonFSClient } from "@loonfs/sdk/server";
const client = new LoonFSClient({
environment: "https://your-loonfs-host.example",
token: "YOUR_TOKEN",
});
const start = 0;
const feed = await client.changes.list({
namespace_id: "acme",
after_seq: start,
});
for (const change of feed.changes)
render(change.commit_id, change.message);
const latest = feed.changes.at(-1);
console.log(latest?.committed_by, latest?.committed_at_ms);