New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

aura-storage

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aura-storage

aura-storage

latest
npmnpm
Version
1.0.8
Version published
Maintainers
1
Created
Source

aura-storage 前端最牛逼的本地存储,使用 LruCache 进行优化,存储之后会默认放到内存中,读取会cache取值。

支持 localStorage,sessionStorage,cookie,indexedDB,uniapp

安装依赖

  pnpm install aura-storage
  yarn add aura-storage
  npm install aura-storage

支持 存储加密,支持过期时间, 内部使用LruCache进行优化

使用 createStorage(options)

const storageLocal = createStorage({
  storageAdapter: webLocalAdapter(), // 适配器
  hasEncrypt: false, // 是否加密
  prefix: '', // 默认前缀
  key: '_11111000001111@', // 默认加密的key
  iv: '@11111000001111_' // 默认加密的iv
})

使用 localStorage

import { createStorage, webLocalAdapter } from 'aura-storage'
const storageLocal = createStorage({
  storageAdapter: webLocalAdapter(),
  hasEncrypt: true,
  prefix: '', // 默认前缀
  key: '_11111000001111@', // 默认加密的key
  iv: '@11111000001111_' // 默认加密的iv
})

使用 sessionStorage

import { createStorage, webSessionAdapter } from 'aura-storage'
const storageSession = createStorage({
  storageAdapter: webSessionAdapter(),
  hasEncrypt: true,
  prefix: '', // 默认前缀
  key: '_11111000001111@', // 默认加密的key
  iv: '@11111000001111_' // 默认加密的iv
})
import { createStorage, cookieAdapter } from 'aura-storage'
const storageCookie = createStorage({
  storageAdapter: cookieAdapter(),
  hasEncrypt: true,
  prefix: '', // 默认前缀
  key: '_11111000001111@', // 默认加密的key
  iv: '@11111000001111_' // 默认加密的iv
})

使用 indexedDB 默认使用localForce

import { createStorage, indexedDBAdapter } from 'aura-storage'
const storageIndexedDB = createStorage({
  storageAdapter: indexedDBAdapter(),
  hasEncrypt: true,
  prefix: '', // 默认前缀
  key: '_11111000001111@', // 默认加密的key
  iv: '@11111000001111_' // 默认加密的iv
})

使用 uniapp

import { createStorage, uniAppAdapter } from 'aura-storage'
const storageUniapp = createStorage({
  storageAdapter: uniAppAdapter(),
  hasEncrypt: true,
  prefix: '', // 默认前缀
  key: '_11111000001111@', // 默认加密的key
  iv: '@11111000001111_' // 默认加密的iv
})

Keywords

aura-storage

FAQs

Package last updated on 23 May 2025

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