npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ppzp/bd

v0.1.1

Published

db-like lib for vscode

Readme

@ppzp/bd

license

一个 js 库,应用于 vscode 插件开发,简化数据持久化操作
底层使用 vscode.ExtensionContext.globalState

Why @ppzp/bd

  • 如果你的数据量非常大,应使用 MySQL、MongoDB 之类的大型数据库
    • 但要架设远程数据库服务器
    • 断网的时候插件不能正常使用
  • 如果数据量没那么大,可以考虑 Sqlite3,它可以和插件一起打包发布,不需要架设远程数据库服务器,断网可用
    • 但 Sqlite3 会让插件的体积增大几 M
    • 不同的操作系统、CPU 需要使用不同的 Sqlite3 版本
  • 如果,,,以上都不是问题,那你就不需要 @ppzp/bd

否则,@ppzp/bd 也许值得一试:

  • 不需要架设数据库服务器
  • 断网可用
  • 体积极小(压缩,大约几 Kb)
  • 不存在跨平台问题

原则

  • 宁简陋,不繁琐。简单,所以健壮

使用简介

下面的案例仅展示 @ppzp/bd 的大概用法,具体细节请参考这个 demo

安装

npm install @ppzp/context @ppzp/bd

@ppzp/bd 依赖于 @ppzp/context,用来设置 vscode.ExtensionContext 对象

Collection

Collection 是 @ppzp/bd 的存储单位之一,类似于 MongoDB 里的 Collection 或 MySQL 里的 Table

创建 user collection:

const Collection = require('@ppzp/bd/collection')
const userCollection = new Collection('user')

新增数据

创建用户:

await userCollection.insertOne({
  name: 'ppz',
  year: 3
})

查找数据

获取用户,返回一个数组:

const users = userCollection.getAll()

查找数据

按 id 获取用户,返回一个用户:

const user = userCollection.findById(userId)

更新数据

更新用户,整体替换,非局部更新:

const user = userCollection.findById(userId)
user.name = 'ccz'
user.year = 2
await userCollection.replaceOne(user)

删除数据

删除用户:

await userCollection.deleteById(userId)

更多具体细节请参考这个 demo

bd?

自古以来,编程界有两大难题,一是搞懂需求,二是给变量起名
这个库提供一种类似于数据库(DB)的功能
但称它为 db,实在是太抬举它了,就叫 bd 吧