Data()

Class for loading/parsing data files from disk

new Data()

Methods

static exists(type, id) → {boolean}

Check if a data file exists

Parameters:
Name Type Description
type string
id string
Returns:
boolean

static getDataFilePath(type, id) → {string}

get the file path for a given data file by type (player/account)

Parameters:
Name Type Description
type string
id string
Returns:
string

static isScriptFile(path, fileopt) → {boolean}

Determine whether or not a path leads to a legitimate JS file or not.

Parameters:
Name Type Attributes Description
path string
file string <optional>
Returns:
boolean

static load(type, id) → {*}

load/parse a data file (player/account)

Parameters:
Name Type Description
type string
id string
Returns:
*

static loadMotd()

load the MOTD for the intro screen

Returns:
-

string

static parseFile(filepath) → {*}

Read in and parse a file. Current supports yaml and json

Parameters:
Name Type Description
filepath string
Returns:
* -

parsed contents of file

static save(type, id, data, callback)

Save data file (player/account) data to disk

Parameters:
Name Type Description
type string
id string
data *
callback function

static saveFile(filepath, data, callback)

Write data to a file

Parameters:
Name Type Description
filepath string
data *
callback function