Getting Started
# Install via npm (prebuilt binaries for all platforms)npm install -g imferno
# Or via Cargocargo install imferno# Validate an IMF packageimferno validate /path/to/your.imp
# JSON outputimferno validate /path/to/your.imp --format json
# Verify SHA-1 hashes against PKLimferno validate /path/to/your.imp --verify-hashes
# Custom rules configimferno validate /path/to/your.imp --rules-config rules.json
# Export a full report (JSON)imferno export /path/to/your.impSee the CLI Reference for all commands and options.
[dependencies]imferno-core = "2.0"use imferno_core::package::{Imferno, ValidationOptions, read_dir};
let files = read_dir("/path/to/your.imp")?;let report = Imferno::parse_and_validate(files, &ValidationOptions::default());
if report.is_compliant { println!("OK");} else { for issue in &report.critical { eprintln!("[critical] {} — {}", issue.code, issue.message); } for issue in &report.errors { eprintln!("[error] {} — {}", issue.code, issue.message); }}Parse and report
Section titled “Parse and report”use imferno_core::package::{Imferno, read_dir, build_report, format_report, ValidationOptions};
let files = read_dir("/path/to/your.imp")?;let pkg = Imferno::parse(files)?;let report = build_report(&pkg, &ValidationOptions::default(), None).unwrap();
print!("{}", format_report(&report, false));See the Rust API Reference for the full API surface.
npm install @imferno/wasmESM module powered by WebAssembly. Use it in any browser or bundler.
import { buildReport, formatReport } from '@imferno/wasm';
const report = await buildReport({ 'VOLINDEX.xml': volindexXml, 'ASSETMAP.xml': assetmapXml, 'PKL_abc.xml': pklXml, 'CPL_def.xml': cplXml,});
// Pretty-printconsole.log(formatReport(report));
// Check programmaticallyif (!report.validation.is_compliant) { for (const err of report.validation.errors) { console.error(err.code, err.message); }}See the WASM API Reference for the full API surface.
npm install @imferno/nodeNative bindings via NAPI — filesystem access, hash verification, and native speed.
import { buildReportFromPath, formatReport } from '@imferno/node';
const report = buildReportFromPath('./my-imp');
// Pretty-printconsole.log(formatReport(report));
// Check programmaticallyif (!report.validation.is_compliant) { for (const err of report.validation.errors) { console.error(err.code, err.message); }}Validate from strings
Section titled “Validate from strings”Same API as @imferno/wasm — no filesystem access:
import { buildReport, formatReport } from '@imferno/node';
const report = buildReport({ 'ASSETMAP.xml': assetmapXml, 'PKL_abc.xml': pklXml, 'CPL_def.xml': cplXml,});
console.log(formatReport(report));See the Node.js API Reference for the full API surface.