**Datanautics** is a lightweight key-value storage system with support for nested property access and persistent dumps to disk.
npm install datanauticsDatanautics is a lightweight key-value storage system with support for nested property access and persistent dumps to disk.
It uses string-based paths (like user[0].profile.name) to get/set deeply nested data, and periodically saves the current state to a JSON file for durability.
---
- Dot/bracket notation access (a.b[0]['c'])
- Persistent JSON file storage (auto-saves at configurable intervals)
- Configurable verbosity and custom logger
- Simple API: .get(key), .set(key, value)
- Built on top of property-accessor
---
``bash`
npm install datanautics
---
`ts
const { Datanautics } = require('datanautics');
const store = new Datanautics({
dumpPath: './data.json',
verbose: true,
logger: console,
});
store.set('users[0].name', 'Alice');
console.log(store.get('users[0].name')); // Output: Alice
`
---
You can pass the following options to the constructor:
| Option | Type | Description | Default |
| ---------- | ------------------- | ------------------------------------------------- | ----------------------------------------- |
| dumpPath | string, optional | Path to the JSON file for persistent data storage | node_modules/datanautics/data/data.json |verbose
| | boolean, optional | Log errors during reading/writing | false |logger
| | object, optional | Custom logger (console, winston, etc.) | console |
---
Sets a value in the internal store using a path-based key.
Returns true on success, false if the key is invalid.
Retrieves the value at the specified path.
Returns undefined if the path does not exist or is non-evaluable.
Explicitly creates dump
---
- Settings data triggers a dump to options.dumpPath;
---
- Node.js 14+
---
- property-accessor` – Used for safe deep get/set operations
---