The type of data stored in the database
Creates a new Veloce database instance.
The path to the database file
The base data to use as fallback when no data exists
Configuration options for the database
OptionalautoSave?: booleanWhether data should be automatically saved to the database. This feature only works in proxy mode.
OptionalautoSaveDelayMs?: numberWhen auto-saving is enabled, the database will wait for this duration (in milliseconds) before saving the data. If modified again during this period, the timer resets.
OptionalfileOptions?: WriteFileOptionsFile system options used when saving data to the database file.
Optionalindentation?: null | string | numberThe number of spaces for indentation when saving the file.
OptionalmaxAutoSaveTimeouts?: numberMaximum number of consecutive auto-save timeouts before forcing a save operation.
OptionalnoProxy?: booleanWhether the database should use no-proxy mode. The no-proxy mode disables many features for a more streamlined process. This mode is more optimized, but requires manual data saving.
OptionalonUpdate?: (Callback function triggered on data updates (only in proxy mode). Receives the update method name and operation result.
OptionalsaveRetryTimeoutMs?: numberThe timeout in milliseconds before retrying to save the data if any issues occur.
OptionaluseSync?: booleanWhether to use synchronous file operations by default. If false, asynchronous operations will be used.
Closes the database instance, cancelling any pending saves and cleaning up resources. After closing, no further operations will be performed.
Deletes the database file from the filesystem synchronously. This operation cannot be undone.
Deletes the database file from the filesystem asynchronously. This operation cannot be undone.
Reloads the data from the file synchronously.
Reloads the data from the file asynchronously.
Saves the current state of the database to the file synchronously.
If true, bypasses all checks and immediately saves the data
Saves the current state of the database to the file asynchronously.
If true, bypasses all checks and immediately saves the data
Veloce is a lightweight JSON database that uses proxies to simplify data manipulation. It provides automatic saving (both synchronous and asynchronous), custom configurations, and flexible data handling.