store-worker
v0.0.2
Published
A simple and efficient way to manage persistent configuration in Node.js or Electron applications. It leverages worker threads to handle storage operations, ensuring that your main process remains responsive.
Downloads
133
Maintainers
Readme
store-worker
store-worker
is a simple and efficient way to manage persistent configuration in Node.js or Electron applications. It leverages worker threads to handle storage operations, ensuring that your main process remains responsive.
Installation
NPM
npm install store-worker
import { createStore } from 'store-worker'
Usage
const store = await createStore({
saveThrottle: 10000, // The number of milliseconds to wait before saving the store to disk after a change. This can help to reduce the number of disk writes when making frequent changes to the store.
... // other serializable options are passed to Conf instance
})
// Set a value
store.set('unicorn', '🦄')
// Get a value
console.log(store.get('unicorn'))
//=> '🦄'
// Delete a value
store.delete('unicorn')
Serializable options are passed to Conf.
Synchronously create Store:
import { createStoreSync } from 'store-worker'
const store = createStoreSync(options)