Skip to main content

Neutralino.storage

Neutralinojs has a built-in shared key-value storage. It's like a global LocalStorage for all Neutralinojs modes. Neutralinos.storage exposes methods for interacting with this storage feature.

tip

The storage API persists all data records into .storage directory in the root directory of your application. If you want to clear all data records, delete the .storage directory.

storage.setData(key, data)#

Writes data into Neutralinojs shared storage. 

Parameters#

  • key String: A unique identifier.
  • data Object (optional): Data as a string. If this value is null or undefined, the specific data record will be erased from the disk.
await Neutralino.storage.setData('userDetails',
JSON.stringify({ username: 'TestValue'})
);

storage.getData(key)#

Reads and returns data for a given Neutralinojs shared storage key. 

Parameters#

  • key String: Storage data record identifier.

Return String (awaited):#

Data string of the storage record.

let data = await Neutralino.storage.getData('userDetails');
console.log(`Data: ${data}`);