Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stagas/ministore
ministore is a mini JSON file based key-value store for node.js
https://github.com/stagas/ministore
Last synced: 13 days ago
JSON representation
ministore is a mini JSON file based key-value store for node.js
- Host: GitHub
- URL: https://github.com/stagas/ministore
- Owner: stagas
- License: mit
- Created: 2011-06-01T11:38:59.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2015-11-14T16:04:16.000Z (almost 9 years ago)
- Last Synced: 2024-08-08T15:47:10.874Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 103 KB
- Stars: 11
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ministore
=========Installation:
-------------
npm install ministoreUsage:
------
```javascript// create our db
var Store = require('ministore')('../path/to/db/dir')// create some collections
var users = Store('users')
var sessions = Store('sessions', { polling: 3000 }) // will save every 3 secs// sync way (no callback)
users.set('john', 'doe')
users.get('john') // 'doe'// async way
users.set('mary', 'loo', function(err) {
users.get('mary', function(err, data) {
console.log(data) // 'loo'
})
})```
API methods:
------------All API methods accept a callback as the last argument, making the process async
### get(key)
### set(key, val)
### remove(key)
### push(key, val) / unshift(key, val)
### shift(key) / pop(key)
### has(key)
### all()
### clear()
### list()
### length()
### forEach(fn)
### save()
### eval(key)
### evalshift(key)
### evalpop(key)Example:
```javascript
var math = require('ministore')('mdb')('math')
math.set('add', function (a, b) { return a + b })
math.eval('add')(4, 5) // 9```