Skip to main content

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​

Deserialized

Defined in​

src/serde.ts:108

Properties​

filepath​

private filepath: string

The file path of the JSON file.

Defined in​

src/serde.ts:125


log / _name​

private readonly log_name: string

The name of the class (for logging purposes).

Defined in​

src/serde.ts:130


from()​

static from: (...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​

src/serde.ts:203

Accessors​

json​

get json(): undefined | string

The path to the underlying JSON file, if provided.

Returns​

undefined | string

Defined in​

src/serde.ts:135

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​

src/serde.ts:145


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​

src/serde.ts:172


read()​

static read(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.

Defined in​

src/serde.ts:245