Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-localstorage

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-localstorage

A drop-in substitute for the browser native localStorage API that runs on node.js.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
210K
decreased by-11.66%
Maintainers
1
Weekly downloads
 
Created

What is node-localstorage?

The node-localstorage npm package provides a simple way to emulate the browser's localStorage API in a Node.js environment. This is particularly useful for storing data persistently across sessions in a Node.js application.

What are node-localstorage's main functionalities?

Set Item

This feature allows you to store a key-value pair in the local storage. The data is saved persistently in the specified directory.

const { LocalStorage } = require('node-localstorage');
const localStorage = new LocalStorage('./scratch');
localStorage.setItem('myKey', 'myValue');

Get Item

This feature allows you to retrieve the value associated with a given key from the local storage.

const { LocalStorage } = require('node-localstorage');
const localStorage = new LocalStorage('./scratch');
const value = localStorage.getItem('myKey');
console.log(value);

Remove Item

This feature allows you to remove a key-value pair from the local storage.

const { LocalStorage } = require('node-localstorage');
const localStorage = new LocalStorage('./scratch');
localStorage.removeItem('myKey');

Clear Storage

This feature allows you to clear all key-value pairs from the local storage.

const { LocalStorage } = require('node-localstorage');
const localStorage = new LocalStorage('./scratch');
localStorage.clear();

Other packages similar to node-localstorage

Keywords

FAQs

Package last updated on 29 Oct 2012

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc