Read and write OWLF
Validate OWLF files and convert app exports in the browser, in React Native or in Node.
npm install @owlf/core @owlf/adapters
Convert an export
import { detectAdapters } from "@owlf/adapters";
import { fileFromBlob, stringifyDocument } from "@owlf/core";
const files = [fileFromBlob(droppedFile)]; // a browser File
const [best] = await detectAdapters(files); // [{ adapter, score }], best first
const document = await best.adapter.parse(files);
const text = stringifyDocument(document); // data.owlf.json
Need one app only? Install its package, e.g. @owlf/adapter-daylio, and call daylio.parse(files).
Validate a file
import { parseDocument, validateDocument } from "@owlf/core";
const result = validateDocument(JSON.parse(text));
if (!result.ok) {
console.log(result.issues); // [{ path: "entries.3.mood.level", message: "Unknown level \"x\"" }]
}
const document = parseDocument(text); // throws with the first issues when invalid
validateDocument checks the schema plus what JSON Schema cannot: level references, real calendar dates, zoneless only with an instant.
Runtimes
- Browser and React Native: every package’s main entry. No Node APIs, no network requests.
- Node 22+: ESM and
require(). @owlf/core/testkit: Node and Bun only, it reads fixtures from disk.