@yamlresume/node
v0.16.1
Published
Node.js runtime support for YAMLResume
Maintainers
Readme
@yamlresume/node
Node.js runtime support for YAMLResume.
This package provides programmatic APIs for reading, validating, building,
watching, generating, and translating YAML/JSON resume files. It wraps
@yamlresume/core with Node.js-specific capabilities such as filesystem access
and LaTeX and Typst PDF compilation.
See the practical integration guide for build options, AI file workflows, error handling, and complete examples.
Installation
Node.js 22 or newer is required.
npm install @yamlresume/nodeUsage
import { buildResumeFile, readResumeFile } from '@yamlresume/node'
const { resume, validated } = readResumeFile('resume.yaml')
const { outputs } = await buildResumeFile('resume.yaml')For command-line usage, see the
yamlresume package.
API
readResumeFile
function readResumeFile(
resumePath: string,
options?: ReadResumeFileOptions
): ReadResumeResultRead the resume from the source file (YAML, YML, or JSON) and validate it
against the schema on request. The result includes the resume object, the
validation status ('success' | 'failed' | 'unknown'), and positional errors
with line and column numbers if validation failed.
const { resume, validated, errors } = readResumeFile('resume.yaml')
if (validated === 'failed') {
for (const error of errors ?? []) {
console.log(`${error.path.join('.')}: ${error.message} (line ${error.line})`)
}
}validateResume
function validateResume(
yamlStr: string,
schema: typeof ResumeSchema
): PositionalError[]Validate a raw YAML string against the resume schema. Returns positional errors sorted by line number, or an empty array if validation succeeds.
buildResumeFile
function buildResumeFile(
resumePath: string,
options?: BuildResumeFileOptions
): Promise<BuildResumeResult>Build a YAML resume into one or more outputs (docx, html, markdown,
tex/pdf, or typ/pdf) by iterating through the layouts configured in the
resume's layouts field. Options include PDF generation, validation, output
directory, LaTeX and Typst compilation timeout, and an optional logger. Returns
the list of generated file paths.
const { outputs } = await buildResumeFile('resume.yaml', {
pdf: true,
output: 'dist',
})newResumeFile
function newResumeFile(
resumePath: string,
sampleId: string,
language: LocaleLanguage,
options?: NewResumeFileOptions
): voidCreate a new resume file from a curated sample resume.
newResumeFile('resume.yaml', 'software-engineer', 'en')generateResumeFile
async function generateResumeFile(
resumePath: string,
position: string,
language: string,
options?: GenerateResumeFileOptions
): Promise<void>Generate a new resume file with AI for a given position and language. Supports model selection, retries, streaming chunks via callback, and an optional logger.
translateResumeFile
async function translateResumeFile(
inputPath: string,
outputPath: string,
toLanguage: string,
options?: TranslateResumeFileOptions
): Promise<void>Translate an existing resume to another supported locale language. The source
language is read from locale.language; model selection, retries, streaming,
and logging use the same options as AI generation.
watchResumeFile
function watchResumeFile(
resumePath: string,
options?: BuildResumeFileOptions
): chokidar.FSWatcherWatch a resume source file and rebuild outputs on changes. Uses chokidar
for robust watching (handles atomic saves from editors like vim), runs only
one build at a time, and coalesces bursts of change events into a single
follow-up build.
All functions throw YAMLResumeErrors from @yamlresume/core on failure,
so you can catch and inspect them uniformly:
import { YAMLResumeError } from '@yamlresume/core'
try {
await buildResumeFile('missing.yaml')
} catch (error) {
if (error instanceof YAMLResumeError) {
console.error(error.code, error.message)
}
}