作者: admin

  • 2023 年的 Node.js 生态系统

    nodejs实用模块 库 插件

    访问控制
    根据各种访问控制模式限制用户操作。

    图片
    @casl/CASL
    CASL是一个同构授权 JavaScript 库,它限制允许给定用户访问的资源。

    图片
    Github:https://github.com/stalniy/casl

    casbin
    Node.JS 中支持 ACL、RBAC、ABAC 等访问控制模型的授权库。

    图片
    Github:https://github.com/casbin/node-casbin

    accesscontrol
    Node.js 基于角色和属性的访问控制。

    图片
    Github:https://github.com/onury/accesscontrol

    浏览器测试
    编写在真实浏览器环境中运行的自动化测试。

    图片
    Cypress
    Cypress 是专为现代网络构建的下一代前端测试工具。

    图片
    Github:https://github.com/cypress-io/cypress

    puppeteer
    通过 DevTools 协议控制无头 Chrome 的高级 API。

    图片
    Github:https://github.com/puppeteer/puppeteer

    @playwright/test
    用于自动化 Web 浏览器的高级 API。

    图片
    Github:https://github.com/Microsoft/playwright

    SeleniumHQ/selenium
    来自 Selenium 项目的官方 WebDriver JavaScript 绑定。

    图片
    Github:https://github.com/SeleniumHQ/selenium

    webdriverio
    Node.js 的下一代浏览器和移动自动化测试框架。

    图片
    Github:https://github.com/webdriverio/webdriverio

    构建系统
    管理包含多个不同项目的代码库 (Monorepos)。

    图片
    Lerna
    Lerna 是一个快速、现代的构建系统,用于管理和发布来自同一存储库的多个 JavaScript/TypeScript 包。

    图片
    Github:https://github.com/lerna/lerna

    turbo
    Turborepo 是一个用于 JavaScript 和 TypeScript 代码库的高性能构建系统。

    图片
    Github:https://github.com/vercel/turbo

    nx
    核心 Nx 插件包含 Nx 的核心功能,如项目图、nx 命令和任务编排。

    图片
    Github:https://github.com/nrwl/nx

    构建工具
    将应用的源代码打包到单个文件中,主要用于前端应用程序以最大限度地减少网络请求。

    图片
    Webpack
    为浏览器打包 ECMAScript/CommonJs/AMD 模块。允许将代码库拆分为多个包,可以按需加载。支持加载器预处理文件,即 json、jsx、es7、css、less 以及自定义内容。

    图片
    Github:https://github.com/webpack/webpack

    esbuild
    一个极其快速的 JavaScript 和 CSS 打包器和压缩器。

    图片
    Github:https://github.com/evanw/esbuild

    rollup
    下一代 ES 模块打包工具。

    图片
    Github:https://github.com/rollup/rollup

    代码复杂度
    分析和可视化代码复杂性以帮助重构(遗留)代码库

    图片
    Typhonjs-escomplex
    基于 Babel 解析器的下一代 Javascript 和 Typescript 复杂性报告。

    图片
    Github:https://github.com/typhonjs-node-escomplex/typhonjs-escomplex

    plato
    JavaScript 源代码分析和可视化工具。

    图片
    Github:https://github.com/es-analysis/plato

    代码图
    生成代码内部依赖关系的可视化图表。

    图片
    madge
    从模块依赖关系创建图表。

    图片
    Github:https://github.com/pahen/madge

    dependency-cruiser
    验证并可视化依赖关系。按照规则,JavaScript、TypeScript、CoffeeScript。ES6、CommonJS、AMD。

    图片
    Github:https://github.com/sverweij/dependency-cruiser

    代码检查和格式化程序
    在交付生产之前格式化代码并解决问题。

    图片
    eslint
    一个基于 AST 的 JavaScript 模式检查器。

    图片
    Github:https://github.com/eslint/eslint

    Prettier
    Prettier 是一个代码格式化程序。

    图片
    Github:https://github.com/prettier/prettier

    @typescript-eslint/eslint-plugin
    ESLint 的 TypeScript 插件。

    图片
    Github:https://github.com/typescript-eslint/typescript-eslint

    命令行提示
    通过询问用户输入创建交互式命令行工具。

    图片
    inquirer
    常见交互式命令行用户界面的集合。

    图片
    Github:https://github.com/SBoudrias/Inquirer.js

    prompts
    轻量、美观、人性化的提示。

    图片
    Github:https://github.com/terkelg/prompts

    enquirer
    时尚、直观、人性化的提示系统。对于小型项目来说足够快速和轻量,对于最先进的用例来说足够强大和可扩展。

    图片
    Github:https://github.com/enquirer/enquirer
    命令行样式
    创建漂亮的命令行工具。

    图片
    chalk
    终端字符串样式正确完成

    图片
    Github:https://github.com/chalk/chalk

    命令行实用程序
    使用 Node.js 创建强大的命令行应用。

    图片
    commander
    Node.js 命令行程序的完整解决方案。

    图片
    Github:https://github.com/tj/commander.js

    yargs
    Yargs 框架通过使用 Node.js 构建功能全面的命令行应用,它能轻松配置命令,解析多个参数,并设置快捷方式等,还能自动生成帮助菜单。

    图片
    Github:https://github.com/yargs/yargs

    minimist
    一个用来解析命令行选项的库。

    图片
    Github:https://github.com/minimistjs/minimist

    CSV 解析器
    从 Node.js 处理 CSV 文件。

    图片
    csv-parse
    CSV 解析实现 Node.js stream.Transform API。

    图片
    Github:https://github.com/adaltas/node-csv

    papaparse
    适用于浏览器的快速而强大的 CSV 解析器,支持 Web Worker 和流式处理大文件。将 CSV 转换为 JSON 以及将 JSON 转换为 CSV。

    图片
    Github:https://github.com/mholt/PapaParse

    时间&日期
    比标准库更直观的日期和时间方法。

    图片
    moment
    解析、验证、操作和显示日期。

    图片
    Github:https://github.com/moment/moment

    dayjs
    2KB的不可变日期时间库,是Moment.js的现代API的替代方案。

    图片
    Github:https://github.com/iamkun/dayjs

    date-fns
    现代 JavaScript 日期实用程序库。

    图片
    Github:https://github.com/date-fns/date-fns

    依赖管理
    检查过时的依赖项并手动(或自动)更新它们。

    图片
    depcheck
    查找比 package.json 允许的更新版本的依赖项。

    图片
    Github:https://github.com/depcheck/depcheck

    npm-check-updates
    检查是否有过时、不正确和未使用的依赖项。

    图片
    Github:https://github.com/raineorshine/npm-check-updates

    npm-check
    自动依赖更新。

    图片
    Github:https://github.com/dylang/npm-check

    电子邮件传送
    从 Node.js 轻松发送电子邮件。

    图片
    nodemailer
    从 Node.js 应用发送电子邮件。

    图片
    Github:https://github.com/nodemailer/nodemailer

    Excel 电子表格
    在 Node.js 中解析并编写 Excel 电子表格

    图片
    XLSX
    SheetJS 电子表格数据解析器和编写器。

    图片
    Github:https://github.com/SheetJS/sheetjs

    exceljs
    Excel 工作簿管理器 – 读写 xlsx 和 csv 文件。

    图片
    Github:https://github.com/exceljs/exceljs

    文件上传
    在 Node.js 应用中处理文件上传。

    图片
    busboy
    Node.js HTML 表单数据的流式解析器。

    图片
    Github:https://github.com/mscdex/busboy

    formidable
    用于解析表单数据(尤其是文件上传)的 Node.js 模块。

    图片
    Github:https://github.com/node-formidable/formidable

    multer
    用于操作“multipart/form-data”的中间件。

    图片
    Github:https://github.com/expressjs/multer

    全栈框架
    使用这些框架快速开发全栈应用。

    图片
    Nest
    Nest – 现代、快速、强大的 Node.js Web 框架 (@core)。

    图片
    Github:https://github.com/nestjs/nest

    HTML 抓取工具
    从 HTML 中轻松查找并提取所需的数据。

    图片
    jsdom
    许多 Web 标准的 JavaScript 实现。

    图片
    Github:https://github.com/jsdom/jsdom

    cheerio
    专为服务器设计的核心 jQuery 的小型、快速且优雅的实现。

    图片
    Github:https://github.com/cheeriojs/cheerio

    HTTP 客户端
    发送网络请求并从外部 API 获取数据。

    图片
    node-fetch
    一个轻量级模块,将 Fetch API 引入 Node.js。

    图片
    Github:https://github.com/node-fetch/node-fetch

    axios
    适用于浏览器和 Node.js 的基于 Promise 的 HTTP 客户端。

    图片
    Github:https://github.com/axios/axios

    HTTP 框架
    基于 HTTP verbs和路由的极简框架。

    图片
    express
    快速、极简的 Web 框架。

    图片
    Github:https://github.com/expressjs/express

    Koa
    Koa Web 应用框架。

    图片
    Github:https://github.com/koajs/koa

    HTTP 模拟
    模拟网络请求并隔离测试模块。

    图片
    superagent
    优雅且功能丰富的浏览器/Node.js HTTP 以及流畅的 API。

    图片
    Github:https://github.com/ladjs/superagent

    nock
    一个 HTTP 模拟和预期测试库,用于 Node.js 平台。

    图片
    Github:https://github.com/nock/nock

    msw
    适用于浏览器和 Node.js 的无缝 REST/GraphQL API 模拟库。

    图片
    Github:https://github.com/mswjs/msw

    作业队列
    从主线程中安排和处理 CPU 密集型任务。

    图片
    bull
    基于Redis的一个Node.js任务队列管理库。

    图片
    Github:https://github.com/OptimalBits/bull

    bullmq
    基于Redis的消息和作业队列。

    图片
    Github:https://github.com/taskforcesh/bullmq

    JSON 模式验证器
    使用 JSON Schema 语言来验证用户输入和其他任何内容。

    图片
    ajv
    一个流行的JSON模式验证库,用于验证和校验JavaScript对象是否符合预定义的JSON模式(JSON Schema)。

    图片
    Github:https://github.com/ajv-validator/ajv

    JSON Web Token (JWT)
    在 Node.js 中签署并验证 JWT。

    图片
    jsonwebtoken
    JSON Web Token 实现(对称和非对称)。

    图片
    Github:https://github.com/auth0/node-jsonwebtoken

    日志记录
    日志记录事件以帮助调试应用中的问题。

    图片
    npmlog
    npmlog 是一个用于在命令行界面输出日志的Node.js库。

    图片
    Github:https://github.com/npm/npmlog

    winston
    几乎所有内容的日志记录器。

    图片
    Github:https://github.com/winstonjs/winston

    loglevel
    JavaScript 的最小轻量级日志记录,向任何可用的 console.log 方法添加可靠的日志级别方法。

    图片
    Github:https://github.com/pimterry/loglevel

    MongoDB 客户端
    Node.js 的 MongoDB 客户端。

    图片
    mongodb
    Node.js 的官方 MongoDB 驱动程序。

    图片
    Github:https://github.com/mongodb/node-mongodb-native

    mongoose
    Node.js环境下一款优秀的MongoDB对象建模工具。

    图片
    Github:https://github.com/Automattic/mongoose

    MySQL 客户端
    MySQL 的 Node.js 驱动程序。

    图片
    mysql
    mysql 的 Node.js 驱动程序。它是用 JavaScript 编写的,不需要编译。

    图片
    Github:https://github.com/mysqljs/mysql

    mysql2
    一个用于Node.js的MySQL数据库驱动程序。它是mysql模块的一种增强版,提供更高性能和更好的功能。

    图片
    Github:https://github.com/sidorares/node-mysql2

    对象关系映射 (ORM)
    将 SQL 数据库表映射到 JavaScript 对象。

    图片
    Prisma
    Prisma 是一个开源数据库工具包。它包括用于 Node.js 的 JavaScript/TypeScript ORM、迁移和用于查看和编辑数据库中的数据的现代 GUI。

    图片
    Github:https://github.com/prisma/prisma

    Sequelize
    Sequelize 是一个基于 Promise 的 Node.js ORM 工具,适用于 Postgres、MySQL、MariaDB、SQLite、Microsoft SQL Server、Amazon Redshift 和 Snowflake 的数据云。它具有可靠的事务支持、关系、急切和延迟加载、读取复制等功能。

    图片
    Github:https://github.com/sequelize/sequelize

    typeorm
    适用于 TypeScript、ES7、ES6、ES5 的数据映射器 ORM。支持 MySQL、PostgreSQL、MariaDB、SQLite、MS SQL Server、Oracle、MongoDB 数据库。

    图片
    Github:https://github.com/typeorm/typeorm

    对象模式验证
    使用对象模式进行简单直观的验证。

    图片
    joi
    一个用于JavaScript对象模式验证的库。

    图片
    Github:https://github.com/hapijs/joi

    zod
    具有静态类型推断的 TypeScript-first 模式声明和验证库。

    图片
    Github:https://github.com/colinhacks/zod

    yup
    非常简单的对象模式验证。

    图片
    Github:https://github.com/jquense/yup

    包发布
    自动化包发布工作流程。

    图片
    semantic-release
    一个自动化版本发布工具,它遵循语义化版本规范,根据提交的代码变动自动生成适当的版本号,并发布到代码仓库。

    图片
    Github:https://github.com/semantic-release/semantic-release

    standard-version
    一个基于语义化版本规范的版本管理工具。它帮助开发者自动化生成版本号和生成变更日志,以及标记代码库中的重大版本发布。

    图片
    Github:https://github.com/conventional-changelog/standard-version

    打包为可执行文件
    将 Node.js 应用打包成单个可执行文件。

    图片
    @vercel/ncc用于将 Node.js 模块打包成单个文件。它可以将项目中的多个模块打包成一个独立的 JavaScript 文件,方便在不需要依赖管理器或构建工具的环境中运行。
    图片
    Github:https://github.com/vercel/ncc

    pkg
    一个命令行工具,用于将 JavaScript 代码打包成可执行的二进制文件。它提供了一种将 Node.js 应用程序打包为可独立运行的可执行文件的方法,无需依赖外部的 Node.js 安装。

    图片
    Github:https://github.com/vercel/pkg

    PDF 生成
    使用 Node.js 生成 PDF 文件。

    图片
    jspdf
    一个使用 JavaScript 生成 PDF 文档的开源库。

    图片
    Github:https://github.com/MrRio/jsPDF

    pdfmake
    一个用于在客户端中生成 PDF 文档的库。它提供了一种简单而强大的方式来创建具有丰富内容和样式的 PDF 文件。

    图片
    Github:https://github.com/bpampuch/pdfmake

    pdfkit
    Node.js 的 PDF 生成库。

    图片
    Github:https://github.com/foliojs/pdfkit

    pdf-lib
    使用 JavaScript 创建和修改 PDF 文件。

    图片
    Github:https://github.com/Hopding/pdf-lib

    PostgreSQL 客户端
    从 Node.js 与 PostgreSQL 数据库交互。

    图片
    pg
    PostgreSQL 客户端 – 具有相同 API 的纯 javascript 和 libpq。

    图片
    Github:https://github.com/brianc/node-postgres

    查询生成
    编写 JavaScript 来构建 SQL 查询。

    图片
    knex
    一个以 JavaScript 编写的 SQL 查询构建器,用于 Node.js 和浏览器环境中与数据库进行交互。它提供了一套简洁而强大的 API,使开发者能够以更直观的方式构建和执行 SQL 查询。

    图片
    Github:https://github.com/knex/knex

    Redis 客户端
    Node.js 的 Redis 客户端。

    图片
    ioredis
    适用于 Node.js 的强大、注重性能且功能齐全的 Redis 客户端。

    图片
    Github:https://github.com/luin/ioredis

    redis
    现代、高性能 Redis 客户端。

    图片
    Github:https://github.com/redis/node-redis

    调度
    按计划运行任务。

    图片
    cron
    一个用于执行定期任务的时间调度工具。它是基于时间的作业调度器,可以按照指定的时间规则自动执行预定的任务。

    图片
    Github:https://github.com/kelektiv/node-cron

    node-schedule
    一个用于在 Node.js 中执行定时任务的模块。它提供了一种简单而灵活的方式来安排和管理定时任务,可以根据指定的时间规则触发任务的执行。

    图片
    Github:https://github.com/node-schedule/node-schedule

    shell 执行
    从 Node.js 执行 shell 命令。

    图片
    execa一个用于在 Node.js 中执行外部命令的模块。
    图片
    Github:https://github.com/sindresorhus/execa

    shelljs
    一个基于 Node.js 的轻量级模块,它提供了一组可在命令行中运行的 Shell 命令的封装和工具函数。ShellJS 的目标是让在 Node.js 环境中使用命令行操作变得更加简单和方便。

    图片
    Github:https://github.com/shelljs/shelljs

    SQLite客户端
    SQLite 的 Node.js 驱动程序。

    图片
    sqlite3
    一个用于访问 SQLite 数据库的模块。SQLite 是一种嵌入式关系型数据库引擎,它以轻量级和高效性而闻名。sqlite3 模块允许您在 Node.js 应用程序中使用 JavaScript 来执行与 SQLite 数据库的交互操作。

    图片
    Github:https://github.com/TryGhost/node-sqlite3

    better-sqlite3
    一个在 Node.js 中使用的 SQLite3 数据库封装模块。它提供了一个简洁、易用和高性能的接口,让开发者可以方便地在 Node.js 应用程序中与 SQLite 数据库交互。

    图片
    Github:https://github.com/WiseLibs/better-sqlite3

    静态服务器
    在 localhost 上提供静态生成的站点。

    图片
    http-server
    一个简单的命令行工具,用于在您的本地开发环境中快速启动一个基于 HTTP 的静态文件服务器。它允许您将当前目录下的文件作为静态资源托管,并通过 HTTP 协议提供这些文件。

    图片
    Github:https://github.com/http-party/http-server

    serve
    一个用于在本地开发环境中快速启动静态文件服务器的命令行工具。它是由 Vercel 开发的,旨在提供一个简单、轻量级且易于使用的方式来运行静态网站或应用程序。

    图片
    Github:https://github.com/vercel/serve

    模板引擎
    渲染动态 HTML 输出。

    图片
    ejs
    一种简单而灵活的模板引擎,用于在Node.js和浏览器中生成动态HTML页面。它允许您在你的HTML模板中嵌入JavaScript代码,以动态地生成内容。

    图片
    Github:https://github.com/mde/ejs

    handlebars
    一个简单、高效的模板引擎,用于在 Web 应用程序中生成动态的 HTML 页面。它基于 Mustache 模板语法,并扩展了一些功能。

    图片
    Github:https://github.com/handlebars-lang/handlebars.js

    测试框架
    帮助编写自动化测试的框架。

    图片
    jest
    一个用于 JavaScript 测试的现代化、开源的测试框架。它被广泛应用于前端开发和 Node.js 环境中,旨在提供简单、高效和可扩展的测试解决方案。

    图片
    Github:https://github.com/facebook/jest

    mocha
    一个灵活且功能强大的 JavaScript 测试框架。它适用于前端和后端的 JavaScript 应用程序,可用于编写各种类型的测试,包括单元测试、集成测试和端到端测试等。

    图片
    Github:https://github.com/mochajs/mocha

    Web 认证
    处理 Web 应用的用户身份验证。

    图片
    express-session
    一个用于处理会话管理的 Node.js 中间件。它基于 Express 框架,提供了简单且易于使用的会话管理解决方案。

    图片
    Github:https://github.com/expressjs/session

    passport
    一个用于身份验证的 Node.js 中间件。它提供了一种简单且灵活的方式来实现用户认证功能。

    图片
    Github:https://github.com/jaredhanson/passport

    Web 抓取框架
    使用 Node.js 爬取和抓取整个网站。

    图片
    crawlee
    适用于 JavaScript/Node.js 的可扩展网络爬取库。支持使用无头 Chrome 和 Puppeteer 开发数据提取和 Web 自动化作业。

    图片
    Github:

    https://github.com/apify/crawlee

  • 推荐:node可视化版本管理器nvm-desktop

    node版本管理可视化工具。之前有nvm的DOS界面版本也可以,这次的nvm-desktop更加人性化可视化界面操作。

    下载地址:https://github.com/1111mp/nvm-desktop/releases

    1,window下在path环境变量添加%HOMEDIR%\.nvmd\bin

    2,在dos界面用管理员权限执行

    setx -m NVMD path

    3,安装对应的版本后在“已安装”出选择要应用的版本

    之后再dos界面测试下是否安装成功node -v

    4,最值得最推荐的功能就是为每个不同项目选用不同的node版本,在“项目”处添加项目目录即可。

    这样设置之后,全局的 Node.js 版本和项目的 Node.js 版本互不干扰。

    文章来源

     

    设置源:

    https://nodejs.org/dist/

    https://cdn.npmmirror.com/binaries/node

  • echarts提取地图某部分、或者将地图某几块区域合并成一个整体

    echarts 地图

    1,首先获取全国或者某个省的json数据

    https://datav.aliyun.com/portal/school/atlas/area_selector

    这里我选择海南省

    备用地址https://sdeno.com/wp-content/uploads/2024/01/mapshaper/mapshaper.org/index.html

     

    提起指定模块

    这里我将海口市和文昌市单独提取出来,其他的不要

    打开https://mapshaper.org/,将第一步得到的map.geojson数据拖进去,点击“Import”导入

    之后点击右上角的“console”

    将以下命令输入到dos界面中并回车

    filter '"海口市,文昌市".indexOf(name) > -1' -o result.json  //意思是将字段name含有海口市,文昌市单独提取出来

    回车之后会另存为一个result.json的文件,把这里面的文件内容复制到http://geojson.io/#map=6.92/30.202/107.744看看是否正常识别

     

    将地图指定的某个区域合并成一个整体

    这里我将海口和文昌合并成一个整体,其他的不变。

    将海南省的map.geojson内容粘贴到http://geojson.io/#map=6.92/30.202/107.744

    将海口市和文昌市的alias字段值设置成一样,其他的一一对应的名称也必须填上,之后点击左边的另存为按钮得到map.geojson

    把map.geojson导入到https://mapshaper.org/,中输入

    dissolve 'alias' -o result.json //将含有alias字段的区域合并成一个整体,其他的其余

    回车就会另存为得到result.json,在把数据粘贴到http://geojson.io/#map=6.92/30.202/107.744中验证是否成功。

  • 本地存储localForage可以存储大量本地离线数据

    localForage 是一个 JavaScript 库。localForage 有一个优雅降级策略,会优先级使用 IndexedDB其次WebSQL,如果不支持则使用 localStorage。

    既然要存储的数量大,得排除cookie
    localStorage,虽然比cookie多,但是同样有上限(5M)左右,备选
    websql 使用简单,存储量大,兼容性差,备选
    indexDB api多且繁琐,存储量大、高版本浏览器兼容性较好,理论上是硬件有多大内存就可以存多少,基本最小是250M起步,备选

    所以在所有主流浏览器中都可用:Chrome,Firefox,IE 和 Safari(包括 Safari Mobile)。下面是 indexDB、web sql、localStorage 的一个浏览器支持情况,可以发现,兼容性方面loaclForage基本上满足99%需求。

     

    安装:

    npm install localforage
    或者
    // 直接引用
    <script src="localforage.js"></script>
    <script>console.log('localforage is: ', localforage);</script>

     

    获取值

    localforage.getItem('somekey').then(function(value) {
        // 当离线仓库中的值被载入时,此处代码运行
        console.log(value);
    }).catch(function(err) {
        // 当出错时,此处代码运行
        console.log(err);
    });
    
    // 回调版本:
    localforage.getItem('somekey', function(err, value) {
        // 当离线仓库中的值被载入时,此处代码运行
        console.log(value);
    });
    

     

    设置值

    存储的数据类型

    将数据保存到离线仓库。你可以存储如下类型的 JavaScript 对象:

    Array
    ArrayBuffer
    Blob
    Float32Array
    Float64Array
    Int8Array
    Int16Array
    Int32Array
    Number
    Object
    Uint8Array
    Uint8ClampedArray
    Uint16Array
    Uint32Array
    String

    //字符串
    localforage
      .setItem("somekey", "some value")
      .then(function (value) {
        // 当值被存储后,可执行其他操作
        console.log(value);
      })
      .catch(function (err) {
        // 当出错时,此处代码运行
        console.log(err);
      });
    
    
    //数组
    // 不同于 localStorage,你可以存储非字符串类型
    localforage
      .setItem("my array", [1, 2, "three"])
      .then(function (value) {
        // 如下输出 `1`
        console.log(value[0]);
      })
      .catch(function (err) {
        // 当出错时,此处代码运行
        console.log(err);
      });
    
    
    //数据流
    // 你甚至可以存储 AJAX 响应返回的二进制数据
    req = new XMLHttpRequest();
    req.open("GET", "/photo.jpg", true);
    req.responseType = "arraybuffer";
    
    req.addEventListener("readystatechange", function () {
      if (req.readyState === 4) {
        // readyState 完成
        localforage
          .setItem("photo", req.response)
          .then(function (image) {
            // 如下为一个合法的 <img> 标签的 blob URI
            var blob = new Blob([image]);
            var imageURI = window.URL.createObjectURL(blob);
          })
          .catch(function (err) {
            // 当出错时,此处代码运行
            console.log(err);
          });
      }
    });

     

    删除存储

    localforage.removeItem('somekey').then(function() {
        // 当值被移除后,此处代码运行
        console.log('Key is cleared!');
    }).catch(function(err) {
        // 当出错时,此处代码运行
        console.log(err);
    });

     

     

    清空存储

    localforage.clear().then(function() {
        // 当数据库被全部删除后,此处代码运行
        console.log('Database is now empty.');
    }).catch(function(err) {
        // 当出错时,此处代码运行
        console.log(err);
    });

     

    https://localforage.docschina.org/

     

  • esxi直通NVME硬盘给群晖7.1当缓存

    链接:https://pan.baidu.com/s/1J_Qf5en4uRcTeUOSYVo-sA
    提取码:efu0
    –来自百度网盘超级会员V6的分享