LocalStorage
Simple storage library with temp file options for node.js
Why?
I so many times needed a simple local storage or temp storage and it simplify all the process.
Installation
npm install node-lstorage
Usage
It's so easy to use.
First you need to define it:
const storage = ; // I recommend use `storage` name for var.
Simple
let notifications = false; { storage; ifstorage notifications = storage; else storage; console;};
Change File Name
let notifications = false; { storage; ifstorage notifications = storage; else storage; console;};
Save Multiple Data
let notifications = false;let normal_width = 800;let normal_height = 1024; { storage; if!storage console; storage; ifstorage notifications = storage; else storage; ifstorage normal_width = storage; else storage; ifstorage normal_height = storage; else storage; console;};
Temp file system
let notifications = false; { storage; // Initialize temp storage system ifstoragetmp notifications = storage; else storagetmp; console; console; console; storagetmp; // Delete temp file console;};
Properties
Property | Description |
---|---|
data |
JSON file data as object. |
lFile |
Used JSON file path. |
Methods
Property | Description | Params |
---|---|---|
get |
JSON file data as object. | *String Property |
set |
Set JSON property value. | *(String ) Property, *(Any ) Value OR (Object ) Values |
has |
Verify JSON property exists. | *(String |Array ) Property |
load |
Load JSON file data. | (String ) JSON File Path |
empty |
Empty JSON file. | |
tmp |
Instance temp file system subclass. |
TMP Subclass methods
Property | Description | Params |
---|---|---|
get |
Temp JSON file data as object. | *String Property |
set |
Set temp JSON property value. | *(String ) Property, *(Any ) Value OR (Object ) Values |
has |
Verify temp JSON property exists. | *(String |Array ) Property |
delete |
Delete temp JSON file. |