Class: Storage

Storage()

Class for loading and storing data.

Constructor

new Storage()

Source:

Methods

addToMainStorageArr(field, toAppend)

Updates an array in the mainstorage: Reads the mainstorage field first, then pushes the new value to the array and writes the array back to the storage.
Parameters:
Name Type Description
field string The name of a field (which contains an array!).
toAppend any The element which should be appended to the array.
Source:

deleteData()

Deletes a given entry in a given file.
Source:

deletePath()

Deletes a given directory and all of its contents.
Source:

exists()

Checks whether a given path exists.
Source:

getCurrentFilename()

Returns the name of the current file (with .json ending!).
Source:

getData()

Filters data from a given file according to a given quest.
Source:

getDataPath()

Returns the path to the folder containing the data.
Source:

getJsonFiles()

Returns all json files which have data in it, sorted by their name (date).
Source:

readJsonFile()

Returns the content of an arbitrary json file.
Source:

readMainStorage()

Reads a specified field in the mainStorage.
Source:

readPreference()

Reads a field in the settings.
Source:

removeFile()

Removes a given file.
Source:

removeStats()

After deleting an object, this function removes the object's influence on the statistics.
Source:

renamePath()

Renames a given directory.
Source:

replaceData()

Replaces a specific file with new data.
Source:

storeData()

Stores data in the appropriate data file. The file is determined by the date of the data.
Source:

storePreference()

Saves a value in the settings.
Source:

writeMainStorage()

Writes to the mainstorage and sets a new value for the specified field.
Source: