
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
balena-settings-storage
Advanced tools
Balena settings storage utilities.
The intention of this module is to provide low level access to how balena 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 balena SDK instead.
Install balena-settings-storage
by running:
$ npm install --save balena-settings-storage
storage
Promise
[ 'Promise' ].<*>
[ 'Promise' ].<Boolean>
Promise
Promise
storage
Kind: static method of storage
Summary: Get an instance of storage module
Access: public
Param | Type | Description |
---|---|---|
options | Object | options |
[options.dataDirectory] | String | False | the directory to use for storage in Node.js or false to create an isolated in memory instance. Values other than false are ignored in the browser. |
Example
// with es6 imports
import { getStorage } from 'balena-settings-storage';
// or with node require
const { getStorage } = require('balena-settings-storage');
const storage = getStorage({
dataDirectory: '/opt/cache/balena'
});
storage
Promise
[ 'Promise' ].<*>
[ 'Promise' ].<Boolean>
Promise
Promise
Promise
Kind: inner method of getStorage
Summary: Set a value
Access: public
Param | Type | Description |
---|---|---|
name | String | name |
value | * | value |
Example
storage.set('token', '1234')
[ 'Promise' ].<*>
Kind: inner method of getStorage
Summary: Get a value
Returns: [ 'Promise' ].<*>
- value or undefined
Access: public
Param | Type | Description |
---|---|---|
name | String | name |
Example
storage.get('token').then((token) => {
console.log(token)
});
[ 'Promise' ].<Boolean>
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.has('token').then((hasToken) => {
if (hasToken) {
console.log('Yes')
} else {
console.log('No')
});
Promise
Kind: inner method of getStorage
Summary: Remove a value
Access: public
Param | Type | Description |
---|---|---|
name | String | name |
Example
storage.remove('token')
Promise
Kind: inner method of getStorage
Summary: Remove all values
Access: public
Example
storage.clear()
If you're having any problem, please raise an issue on GitHub and the balena team will be happy to help.
Run the test suite by doing:
$ npm test
Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:
$ npm run lint
The project is licensed under the Apache 2.0 license.
v8.1.0
FAQs
Balena settings storage utilities
The npm package balena-settings-storage receives a total of 8,236 weekly downloads. As such, balena-settings-storage popularity was classified as popular.
We found that balena-settings-storage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.