Socket
Socket
Sign inDemoInstall

localstorage4node

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    localstorage4node

local storage work as local storage on the browser


Version published
Weekly downloads
4
increased by100%
Maintainers
1
Install size
5.55 kB
Created
Weekly downloads
 

Readme

Source

Localstroge

as we all know there is no localStorage on the server side on nodejs, is functionality witch is available on the browser in the object window. this module gives you the same apporche like you where using the localstorage from the browser. hope you enjoy and help full.

intallation

    npm install localstorage

Integration

* `import` or `require`
    // if you are using es5 or les
    const store = require('localstorage4node');
    const localstorage=store.default;

    // for es6 and above
    import localstorage from "localstorage4node";

then you can access defined module

    console.log("localStorage length: ", localStorage.length);

    let UI_D = localStorage.getItem("user_id");

    console.log("user_id: ", UI_D);

    if (!UI_D) {
        console.log('user ID not found!','Setting the user id and token...');
        localStorage.setItem("user_id", "123456");
        localStorage.setItem("username", "johnDoe");
        localStorage.setItem("token", "Qw3rT5yui8oPlkjHg0fDsa");
    } else {
        console.log('user ID:', UI_D);
        console.log('delete user ID');
        localStorage.clear();
    }

Enjoy

Keywords

FAQs

Last updated on 02 Jan 2021

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc