Skip to content

backrunner/userdata-storage

Repository files navigation

userdata-storage

Simple JSON storage based on system user data folder.

This project is created by create-a-typescript-lib.

Usage

Step 1: Install package

$ npm install userdata-storage

Step 2: Import and use this library

import UserDataStorage from 'userdata-storage';

const storage = new UserDataStorage({
  appName: '<appName>',
  storageName: '[storageName]', // optional
  safeKey: '[safeKey]', // better for security, can avoid others to read the data.
});

await storage.set(key, payload);
await storage.get(key);
await storage.remove(key);

// or using the synchronous methods (⚠ The methods include locks, be aware of dead lock)

storage.setSync(key, payload);
storage.getSync(key);
storage.removeSync(key);

License

MIT

About

Simple JSON storage based on system user data folder

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published