Export and Import
Nymph provides a method for exporting and importing its entities and UIDs, regardless of which driver is currently in use. This allows backup, restore, duplication, or transferring an entire database, even with different database drivers.
Nymph has the following methods for exporting and importing entities.
export
- Export entities to a file.exportPrint
- Export entities to the console.import
- Import entities from a file.
// Export entities to a file.
nymph.export(filename);
// Export entities to the console.
nymph.exportPrint();
// Import entities from a file.
nymph.import(filename);
The format of a Nymph export file is simple, and readable by all drivers. The file extension, nex, stands for Nymph Entity eXchange.
#nex2
# The above line must be the first thing in the file.
# Comments begin with #
# And can have white space before them.
# This defines a UID.
<name/of/uid>[5]
<another uid>[8000]
# For UIDs, the name is in angle brackets (<>) and the value follows
# in square brackets ([]).
# This starts a new entity.
{1234abcd}<etype>[tag,list,with,commas]
# For entities, the GUID is in curly brackets ({}), then the etype in
# angle brackets, then the comma separated tag list follows in square
# brackets ([]).
# Properties are stored like this:
# propname=JSON.stringify(value)
abilities=["system/all"]
groups=[]
inheritAbilities=false
name="admin"
# White space before/after "=" and at beginning/end of line is ignored.
username = "admin"
{2}<etype>[tag,list]
another="This is another entity."
newline="\n"