Logo of unstorage

unstorage

具有数十个内置驱动和微小核心的异步键值存储 API。

Unstorage 提供了一个异步的键值存储 API,具备多驱动器挂载、监听、元数据处理、数十种内置驱动器以及一个 轻量级核心 等常规功能。

👉 文档

功能特性

  • 专为所有环境设计:浏览器、NodeJS 和 Worker
  • 大量内置驱动器
  • 异步 API
  • Unix 风格的驱动器挂载以组合存储
  • 默认 内存 存储
  • 可进行 Tree-shaking 的工具和轻量级核心
  • 自动 JSON 值序列化和反序列化
  • 支持二进制和原始值
  • 状态 快照 和恢复
  • 存储监视器
  • 带有 内置服务器 的 HTTP 存储

用法

安装 unstorage npm 包

# yarn
yarn add unstorage

# npm
npm install unstorage

# pnpm
pnpm add unstorage
import { createStorage } from "unstorage";

const storage = createStorage(/* opts */);

await storage.getItem("foo:bar"); // or storage.getItem('/foo/bar')

👉 查看文档以获取使用信息。

贡献

  • 克隆仓库
  • 使用 pnpm install 安装依赖项
  • 使用 pnpm dev 启动 Jest 监视器以验证更改
  • 在推送前使用 pnpm test 确保所有测试和 Lint 检查通过

许可

MIT