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

dom-storage

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-storage

W3C DOM Storage (localStorage and sessionStorage) for Node.JS

  • 2.0.2
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created

What is dom-storage?

The dom-storage npm package is a simple implementation of the W3C DOM Storage API, which provides a way to store key-value pairs in a web browser. It is useful for server-side JavaScript environments like Node.js where the browser's localStorage and sessionStorage are not available.

What are dom-storage's main functionalities?

localStorage

This feature allows you to use localStorage in a Node.js environment. You can set, get, remove, and clear items just like you would in a browser.

const { LocalStorage } = require('dom-storage');
const localStorage = new LocalStorage('./localStorage');

// Set an item
localStorage.setItem('key', 'value');

// Get an item
const value = localStorage.getItem('key');
console.log(value); // Outputs: 'value'

// Remove an item
localStorage.removeItem('key');

// Clear all items
localStorage.clear();

sessionStorage

This feature allows you to use sessionStorage in a Node.js environment. You can set, get, remove, and clear items just like you would in a browser.

const { SessionStorage } = require('dom-storage');
const sessionStorage = new SessionStorage();

// Set an item
sessionStorage.setItem('key', 'value');

// Get an item
const value = sessionStorage.getItem('key');
console.log(value); // Outputs: 'value'

// Remove an item
sessionStorage.removeItem('key');

// Clear all items
sessionStorage.clear();

Other packages similar to dom-storage

FAQs

Package last updated on 21 Jan 2016

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