Deserialized
DBPF.js v1.1.0 • Docs
DBPF.js v1.1.0 / serde / Deserialized
Class: Deserialized
A class for deserializing JSON files.
Based on how deserialization is implemented in the Rust programming language.
Constructors
new Deserialized()
new Deserialized(
filepath?):Deserialized
Parameters
• filepath?: string
The file path of the JSON file.
Returns
Defined in
Properties
filepath
privatefilepath:string
The file path of the JSON file.
Defined in
log / _name
privatereadonlylog_name:string
The name of the class (for logging purposes).
Defined in
from()
staticfrom: (...args) =>any
Transform an object into a Deserialized instance.
Commonly used by child classes to ensure that the object conforms to the class structure.
Parameters
• ...args: any[]
Returns
any
The transformed object.
Defined in
Accessors
json
getjson():undefined|string
The path to the underlying JSON file, if provided.
Returns
undefined | string
Defined in
Methods
load()
load(
new_path?):boolean
Load the JSON file.
Parameters
• new_path?: string
The new file path to load, if different from the current file path.
Returns
boolean
Whether the file was successfully loaded.
Defined in
save()
save(
new_path?):boolean
Save the JSON file.
Parameters
• new_path?: string
The new file path to save, if different from the current file path.
Returns
boolean
Whether the file was successfully saved.
Defined in
read()
staticread(filepath?):void|Deserialized
A static method to create a new Deserialized instance from a path
Parameters
• filepath?: string
The file path of the JSON file.
Returns
void | Deserialized
The Deserialized instance.