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
Optional
autoSave?: booleanWhether data should be automatically saved to the database. This feature only works in proxy mode.
Optional
autoSaveDelayMs?: 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.
Optional
fileOptions?: WriteFileOptionsFile system options used when saving data to the database file.
Optional
indentation?: null | string | numberThe number of spaces for indentation when saving the file.
Optional
maxAutoSaveTimeouts?: numberMaximum number of consecutive auto-save timeouts before forcing a save operation.
Optional
noProxy?: 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.
Optional
onUpdate?: (Callback function triggered on data updates (only in proxy mode). Receives the update method name and operation result.
Optional
saveRetryTimeoutMs?: numberThe timeout in milliseconds before retrying to save the data if any issues occur.
Optional
useSync?: 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.