@cvfile/cv-detector
v0.1.1
Published
Tiny reference sniffer for the .cv open file format. Detects .cv wrapping inside any application/pdf and unwraps the canonical Markdown payload.
Maintainers
Readme
@cvfile/cv-detector (TypeScript)
pnpm add @cvfile/cv-detectorimport { readFile } from 'node:fs/promises';
import { detect, unwrap } from '@cvfile/cv-detector';
const data = await readFile('resume.pdf');
const det = detect(data);
if (!det.isCvFile) {
console.log('plain PDF, OCR as usual');
} else {
const payload = await unwrap(data);
if (payload) {
const markdown = new TextDecoder().decode(payload.bytes);
console.log(`got ${payload.name} (${payload.mimeType}, ${markdown.length} chars)`);
}
}detect() is dependency free (regex over PDF bytes, runs anywhere a
Uint8Array runs). unwrap() uses pdf-lib to
parse the /AF Associated Files array.
See ../README.md for the cross-language story and rationale.
