Socket
Book a DemoInstallSign in
Socket

appstoragejs

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appstoragejs

LocalStorage for Node.js, auto syncing for objects with JSON files using the Proxy API

1.0.4
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

AppStorage Logo

AppStorage

npm npm

LocalStorage for Node.js, auto syncing for objects with JSON files using the Proxy API

Table of Contents

Installation

npm install --save appstoragejs

Introduction

Use the ES6 Proxy API to set traps to recursively watch changes on an object and sync it automatically with a JSON file within the current event loop phase using fs.writeFileSync.

  • Good for CLI tools, storing configs, user preferences, cached data, states, etc.
  • Bad for production applications, scalable or high-performance applications, web servers, etc.

Usage

  • The data are synced automatically with data.json on every change within the current event loop phase.
  • The data are read automatically from data.json when the app starts.
  • Nothing to worry about just deal with the object as any normal object.
var AppStorage = require('appstoragejs');

// Create a new AppStorage
var appStorage = new AppStorage('data.json');

// Just do anything with your object !
appStorage.name = 'Bob';
appStorage.age = 13;
appStorage.records = [1,2,3,4];

You can define your AppStorage object as a global object to be used anywhere within your app.

global.appStorage = appStorage;

License

This project is under the MIT license.

Keywords

appStorage

FAQs

Package last updated on 15 Jul 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.