Creates a new instance of the persistence.
(optional) a path to the file where data is stored.
Gets the file path where data is stored.
the file path where data is stored.
Sets the file path where data is stored.
the file path where data is stored.
the file path where data is stored.
Configures component by passing configuration parameters.
configuration parameters to be set.
Loads data items from external JSON file.
(optional) transaction id to trace execution through call chain.
callback function that receives loaded items or error.
Saves given data items to external JSON file.
(optional) transaction id to trace execution through call chain.
list if data items to save
callback function that error or null for success.
Generated using TypeDoc
Persistence component that loads and saves data from/to flat file.
It is used by FilePersistence, but can be useful on its own.
Configuration parameters
Example
let persister = new JsonFilePersister("./data/data.json"); persister.save("123", ["A", "B", "C"], (err) => { ... persister.load("123", (err, items) => { console.log(items); // Result: ["A", "B", "C"] }); });