NodeStore.readFromStorage()

Retrieve a key-value pair from the persistent data store. This is compatible with PhoneGap/Cordova

This machinepack provides an easy-to-use key/value pair-based database using the HTML5 localStorage model. With some HTTP requests you should be able to effectively use this as a replacement for cookies on PhoneGap/Cordova-based apps.

Usage

Hover over inputs/exits for more info.

var NodeStore = require('machinepack-nodestore');


// Retrieve a key-value pair from the persistent data store. This is compatible with PhoneGap/Cordova

NodeStore.readFromStorage({

key: 'users',

asJSON: 'true',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// No value was found the provided key.

notFound: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

key required

The name of the key you wish to retrieve.

'users'
asJSON required

If true, this machine will return your value as a JSON object. Otherwise, the value will be returned as a JSON-formatted string as default.

'true'

Exits

error

An unexpected error occurred.

notFound

No value was found the provided key.

success

OK.

'Returned Value'