add typst.ts

This commit is contained in:
2025-11-11 09:13:38 -08:00
parent 9ae44d97bf
commit 791b6e44ac
5 changed files with 41 additions and 19 deletions

View File

@@ -1 +1,14 @@
console.log("Hello via Bun!");
import { $typst } from "@myriaddreamin/typst.ts";
import fs from "fs";
const typstSource = `
= Hello
My name is Typst!
`;
const pdfBuffer = await $typst.pdf({ mainContent: typstSource });
if (!pdfBuffer) {
throw new Error("Failed to generate PDF");
}
fs.writeFileSync("output.pdf", pdfBuffer);