This commit is contained in:
17
docs/snippets/wasm/getting-started/extract_file_async.md
Normal file
17
docs/snippets/wasm/getting-started/extract_file_async.md
Normal file
@@ -0,0 +1,17 @@
|
||||
```typescript title="WASM"
|
||||
import { extractFromFile, initWasm } from "@kreuzberg/wasm";
|
||||
|
||||
await initWasm();
|
||||
|
||||
const fileInput = document.getElementById("file") as HTMLInputElement;
|
||||
const file = fileInput.files?.[0];
|
||||
|
||||
if (file) {
|
||||
const result = await extractFromFile(file);
|
||||
const content = result.content;
|
||||
const tableCount = result.tables.length;
|
||||
|
||||
console.log(`Content length: ${content.length} characters`);
|
||||
console.log(`Tables: ${tableCount}`);
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user