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

nv-storage

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nv-storage

storage for za

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

za-storage

本地数据存储操作库。

支持的存储方式有:

  • localStorage(默认)
  • sessionStorage
  • cookie

安装

$ npm install za-storage

用法

// 引入za-storage库
import Storage from 'za-storage';

// 创建一个Storage实例
let storage = new Storage();

// 创建一个Storage实例并设置本地存储源为cookie
let storage = new Storage({
  source: 'cookie', // 'localStorage' | 'sessionStorage' | 'cookie'
});

// 创建一个Storage实例并设置全局的过期时间,单位:分钟
let storage = new Storage({
  timeout: 1,
});

// 设置指定key的值
// storage.set(key, value, expire, path);
// key 字段
// value 值
// expire 过期时间,单位:分钟
// path cookie路径
storage.set('aaa', '123', 30);
storage.set('bbb', { a: 1, b: '3' }, 2);

// 获取指定key的值
storage.get('aaa');

// 删除指定值
storage.remove('aaa');

// 清空所有值
storage.removeAll();

Keywords

FAQs

Package last updated on 12 Apr 2024

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