Skip to main content

lje.data

Simple persistent blob storage for scripts. Data is stored in a `.lje_script_data` folder relative to the working directory.

Functions

lje.data.write(name, data)

Note: Don't use file extensions, they are purposely omitted for security.

Writes a binary blob to the .lje_script_data folder under the given name. Creates the folder if it does not exist. Returns true on success, false on failure. Progress is always printed to the console.

Parameters

NameTypeDescription
namestring

The name of the data entry to write.

datastring

The raw data to store. May contain binary content.

Returns

TypeDescription
boolean

true if the write succeeded, false if it failed.

lje.data.read(name)

Note: Don't use file extensions, they are purposely omitted for security.

Reads a previously written blob from the .lje_script_data folder. Returns nothing if the folder does not exist or if the entry is not found.

Parameters

NameTypeDescription
namestring

The name of the data entry to read.

Returns

TypeDescription
string | nil

The stored data as a raw string, or nil if not found.