Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/colored-coins/datastorage
Data storage using Redis, file-system or local-storage (for client side).
https://github.com/colored-coins/datastorage
Last synced: 2 months ago
JSON representation
Data storage using Redis, file-system or local-storage (for client side).
- Host: GitHub
- URL: https://github.com/colored-coins/datastorage
- Owner: Colored-Coins
- Created: 2015-10-11T08:35:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-13T16:49:42.000Z (almost 8 years ago)
- Last Synced: 2024-12-03T09:44:56.886Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 2
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# datastorage
[![Build Status](https://travis-ci.org/Colored-Coins/datastorage.svg?branch=master)](https://travis-ci.org/Colored-Coins/datastorage) [![Coverage Status](https://coveralls.io/repos/github/Colored-Coins/datastorage/badge.svg?branch=BLOC-45_engineless-sdk)](https://coveralls.io/github/Colored-Coins/datastorage?branch=BLOC-45_engineless-sdk) [![npm version](https://badge.fury.io/js/data-storage.svg)](http://badge.fury.io/js/data-storage)[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
### Installation
```sh
$ npm i data-storage
```
### Usage```js
var DataStorage = require('data-storage')
var ds = new DataStorage()
ds.once('connect', function () {
console.log('data-storage is now initialized')
})
ds.init()
```### API
#### Constructor:
```js
DataStorage(settings)
```
where `settings` is an object of these properties:
```js
{
redisPort: 6379,
redisHost: '127.0.0.1',
redisUrl: '127.0.0.1:6379' // if specified, redisPort and redisHost are ignored
}
```#### Member methods:
```js
DataStorage.prototype.set(key, value)
DataStorage.prototype.get(key, callback)
DataStorage.prototype.hset(hash, key, callback)
DataStorage.prototype.hget(hash, key, callback)
DataStorage.prototype.hkeys(hash, callback)
```### Testing
```sh
$ mocha
```### License
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)