resin-settings-storage
Resin.io settings storage utilities.
Role
The intention of this module is to provide low level access to how a Resin.io persists settings in both the filesystem and the browser.
THIS MODULE IS LOW LEVEL AND IS NOT MEANT TO BE USED BY END USERS DIRECTLY.
Unless you know what you're doing, use the Resin SDK instead.
Installation
Install resin-settings-storage
by running:
$ npm install --save resin-settings-storage
Documentation
- storage
- .getStorage(options) ⇒
storage
- ~set(name, value) ⇒
Promise
- ~get(name) ⇒
Promise.<*>
- ~has(name) ⇒
Promise.<Boolean>
- ~remove(name) ⇒
Promise
- ~clear() ⇒
Promise
- ~set(name, value) ⇒
- .getStorage(options) ⇒
storage
storage.getStorage(options) ⇒ Kind: static method of storage
Summary: Get an instance of storage module
Access: public
Param | Type | Description |
---|---|---|
options | Object |
options |
options.dataDirectory | string |
the directory to use for storage in Node.js. Ignored in the browser. |
Example
const storage = dataDirectory: '/opt/cache/resin'
- .getStorage(options) ⇒
storage
- ~set(name, value) ⇒
Promise
- ~get(name) ⇒
Promise.<*>
- ~has(name) ⇒
Promise.<Boolean>
- ~remove(name) ⇒
Promise
- ~clear() ⇒
Promise
- ~set(name, value) ⇒
Promise
getStorage~set(name, value) ⇒ Kind: inner method of getStorage
Summary: Set a value
Access: public
Param | Type | Description |
---|---|---|
name | String |
name |
value | * |
value |
Example
storage
Promise.<*>
getStorage~get(name) ⇒ Kind: inner method of getStorage
Summary: Get a value
Returns: Promise.<*>
- value or undefined
Access: public
Param | Type | Description |
---|---|---|
name | String |
name |
Example
storage;
Promise.<Boolean>
getStorage~has(name) ⇒ Kind: inner method of getStorage
Summary: Check if the value exists
Returns: Promise.<Boolean>
- has value
Access: public
Param | Type | Description |
---|---|---|
name | String |
name |
Example
storage
Promise
getStorage~remove(name) ⇒ Kind: inner method of getStorage
Summary: Remove a value
Access: public
Param | Type | Description |
---|---|---|
name | String |
name |
Example
storage
Promise
getStorage~clear() ⇒ Kind: inner method of getStorage
Summary: Remove all values
Access: public
Example
storageclear
Support
If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.
Tests
Run the test suite by doing:
$ npm test
Contribute
- Issue Tracker: github.com/resin-io-modules/resin-settings-storage/issues
- Source Code: github.com/resin-io-modules/resin-settings-storage
Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:
$ npm run lint
License
The project is licensed under the Apache 2.0 license.