Content-addressed version deploy system for Diffuse
elements.diffuse.sh
1import * as Path from "@std/path";
2
3export function execSync(...args: string[]) {
4 const cmd = new Deno.Command(args[0], {
5 args: args.slice(1),
6 });
7
8 return cmd.outputSync();
9}
10
11export function writeCar(path: string, cid: string) {
12 execSync(
13 "deno",
14 "run",
15 "-A",
16 "ipfs-car",
17 "pack",
18 path,
19 "--no-wrap",
20 "--output",
21 Path.join("cars", `${cid}.car`),
22 );
23}
24
25export function utf8String(bytes: Uint8Array) {
26 return new TextDecoder().decode(bytes);
27}