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

proxydb

v0.0.7

Published

Fast access to memory objects

Downloads

12

Readme

proxydb

适用于浏览器、Node环境下的超简易JSON数据库,在浏览器环境下会存储到 localStorage 中、在 node 环境下则以文件存储,其内容均为JSON字符串

操作时和正常的JS对象一致,使用过程中会自动在合适的时候写入。

Usage

npm i proxydb

简单例子

var ProxyDb = require('proxydb');
var Db = new ProxyDb();

Db.name = 'foo';  //  ProxyDb.json 文件内容为:"foo"

复杂点的例子



var ProxyDb = require('proxydb');
var Db1 = new ProxyDb('objDb',{name:"foo"});

Db1.age = 12; //  objDb.json 文件内容为: {"name":"foo","age":12}

var ProxyDb = require('proxydb');
var Db2 = new ProxyDb('arrDb',['foo']);

Db2.push( 'bar' ); //  arrDb.json 文件内容为:["foo","bar"]

初始化时使用了简单数据类型

var ProxyDb = require('proxydb');
var Db = new ProxyDb('badDb',"foo bar" );

console.log( Db.data ); // output: "foo bar"

//  badDb.json 文件内容为:{"data":"foo bar"}

API

new ProxyDb( [filename , [initialization, [isLazy] ] ] )

传入了 filename 后,会自动读取该文件的内容,若没有 数据文件时,则会创建一个,并且以 initialization 的值作为初始值

  • filename
    • 类型: string
    • 默认值:ProxyDb.json
    • 描述:数据文件的名称,若不提供,默认使用 ,如果已有此文件,则不会创建。
  • initialization
    • 类型:object|array
    • 默认值:无
    • 描述:初始化的数据,建议使用 object|array ,当然传一个 string 是允许的,但是会被强制转换为 object 读写时使用 Db.data
  • isLazy
    • 类型: boolean
    • 默认值:true
    • 描述:是否延迟写入,要注意,在值为 false 时,连续写数据时,内容会立即写入到文件中