Read a Frontier object database -- a .root file -- into a JavaScript structure, without Frontier.
If you have data locked in a guest database from Frontier, Radio UserLand, or the OPML Editor, this package gets it out: every table, every script, every outline, every scalar value, as plain JavaScript you can walk with a forEach.
const frontierOdb = require ("frontierodb");
const theDatabase = frontierOdb.readRootFile ("nodeEditor.root");
const glossary = frontierOdb.getAddress (theDatabase, "nodeEditorSuite.data.glossary");readRootFile (path) reads the whole database and returns it as one structure. getAddress (theDatabase, thePath) takes a dotted path, the same way you'd address the object in UserTalk, and returns what it finds there.
It also reads fat pages -- the text files Frontier exports with Export to Fat Page, usually named .fttb for a table, .ftop for an outline, .ftsc for a script:
const thePage = frontierOdb.readFatPage ("nodeEditor.projects.fttb");readFatPage (path) returns {directives, value} -- the directives from the top of the file (where the object came from, its type), and the unpacked value, in the same shapes readRootFile produces.
There's also a command-line tool:
node cli.js database.root
node cli.js database.root dump nodeEditorSuite.data.glossary
node cli.js database.root json outfile.json
The first form lists the structure of the database -- names and types, indented. dump prints one entry as JSON. json writes the whole database to a file.
- A table is an object:
{"type": "table", "value": {...}}, with each entry of the table a property ofvalue. Paths in the database are paths in the structure. - Scalars are plain JSON values -- strings as strings, booleans as booleans, numbers as numbers, dates as ISO 8601 strings.
- Scripts and outlines are
{"type": "script", "lines": [...]}. Each line haslevel(its indent depth),text, and three flags:flExpanded,flComment,flBreakpoint. That's enough to rebuild the outline, render the script as text, or convert to OPML. - Addresses are
{"type": "address", "path": "..."}-- the path as text. - Text comes out as proper Unicode. Frontier stored text in the MacRoman character set; the package converts, so curly quotes and accented characters survive.
- Credentials are never imported. Password-type values, and any value whose name looks like a credential -- password, secret, token, apiKey, accessKey, privateKey, credential, or a value named just "key" -- come out as "xxx". Scripts and tables with those words in their names are code, not secrets, so they read normally.
Wptext (word-processing text), pict, and menubar values come back as a type marker with a byte count -- you can see they're there, they're just not unpacked. Same for doubles and a few other rare types. Nothing is silently dropped.
The kernel of Frontier is open source, released under the GPL by UserLand Software: github.com/scripting/frontier. The on-disk format was learned by reading it -- db.c for the block file, langhash.c for packed tables, oppack.c for packed outlines. This package contains no UserLand code; it's a clean-room reader written from the structures those files describe.
Versions 5 and 6 of the database format are supported -- that's Frontier 5 through 10, Radio UserLand, and the OPML Editor. It reads guest databases and Frontier.root itself.