mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(modality)!: SnapOtter 2.0 phase 3 modality framework: media/doc engines, pool routing, display modes (#218)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import { runDocsScript } from "@snapotter/ai";
|
||||
|
||||
/** Page count via the docs-profile Python dispatcher (pikepdf). */
|
||||
export async function pdfPageCountPy(absPath: string): Promise<number> {
|
||||
const stdout = await runDocsScript("doc_pagecount", { path: absPath });
|
||||
const parsed = JSON.parse(stdout.trim()) as { pages?: number; error?: string };
|
||||
if (parsed.error || typeof parsed.pages !== "number") {
|
||||
throw new Error(`doc_pagecount failed: ${parsed.error ?? stdout.slice(0, 200)}`);
|
||||
}
|
||||
return parsed.pages;
|
||||
}
|
||||
Reference in New Issue
Block a user