1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { blobActions } from "https://esm.town/v/pomdtr/blob_actions";
import { Command } from "https://esm.town/v/pomdtr/cmdk";
import { blob } from "https://esm.town/v/std/blob?v=12";
export const viewBlob: Command = async (ctx) => {
const { key } = ctx.params;
const parts = key.split(".");
const extension = parts[parts.length - 1];
const resp = await blob.get(key);
const text = await resp.text();
return {
type: "detail",
detail: {
markdown: [`# ${key}`, "```" + extension || "txt", text, "```"].join("\n"),
actions: blobActions(key),
},
};
};