import { useEffect, useState } from "octane"; import { Button } from "octane-kumo/components/button"; import type { SkillPackageFile } from "../../shared/skills"; export function SkillFileView({ file }: { file: SkillPackageFile }) { const [download, setDownload] = useState<{ file: SkillPackageFile; url: string; } | null>(null); useEffect(() => { if (file.encoding !== "base64") return; const bytes = Uint8Array.from(atob(file.content), (character) => character.charCodeAt(0), ); const url = URL.createObjectURL( new Blob([bytes], { type: "application/octet-stream" }), ); setDownload({ file, url }); return () => URL.revokeObjectURL(url); }, [file]); return (

{file.path}

{file.encoding === "base64" ? ( <>

This binary file is available as a download. Its contents are not executed.

) : (
{file.content}
)}
); }