Nomad changes
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s

This commit is contained in:
Henrik Jess Nielsen
2026-06-01 23:40:55 +02:00
parent 72b1a0a6ed
commit b4c07d3693
5723 changed files with 1130655 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import { extractFromFile, initWasm } from "@kreuzberg/wasm";
async function setupFileInput() {
await initWasm();
const fileInput = document.getElementById("file-input") as HTMLInputElement;
fileInput.addEventListener("change", async (event) => {
const file = (event.target as HTMLInputElement).files?.[0];
if (!file) return;
try {
const result = await extractFromFile(file);
console.log("Extracted text:", result.content);
displayResults(result);
} catch (error) {
console.error("Extraction failed:", error);
}
});
}
function displayResults(result: any) {
const output = document.getElementById("output");
if (output) {
output.textContent = `${result.content.substring(0, 500)}...`;
}
}
setupFileInput().catch(console.error);