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

@nan0web/db-browser

v1.0.1

Published

Browser Database client as extension of @nan0web/db

Readme

@nan0web/db-browser

Browser Database client as extension of @nan0web/db

|Package name|Status|Documentation|Test coverage|Features|Npm version| |---|---|---|---|---|---| |@nan0web/db-browser |🟢 97.5% |🧪 English 🏴󠁧󠁢󠁥󠁮󠁧󠁿Українською 🇺🇦 |🟡 85.7% |✅ d.ts 📜 system.md 🕹️ playground |1.0.0 |

Description

The @nan0web/db-browser package provides a database interface for browser environments, extending the base @nan0web/db functionality with HTTP-based document operations. Core class:

  • DBBrowser — extends DB with browser-specific features like remote fetching and saving via standard HTTP methods (GET, POST, PUT, DELETE).

This package is ideal for building browser-based applications that require remote data fetching with support for inheritance, references, and directory indexing.

Installation

How to install with npm?

npm install @nan0web/db-browser

How to install with pnpm?

pnpm add @nan0web/db-browser

How to install with yarn?

yarn add @nan0web/db-browser

Fetching Documents

DBBrowser supports fetching documents from remote servers with full URI resolution.

How to fetch a document?

import DBBrowser from "@nan0web/db-browser"
const db = new DBBrowser({
	host: "https://api.example.com",
	root: "/data/"
})
const users = await db.fetch("users.json")
console.info(users)
// [
//   {"email":"[email protected]","id":1,"name":"Alice"},
//   {"email":"[email protected]","id":2,"name":"Bob"},
// ]

Saving Documents

Use POST requests to save new documents. The server side must provide such API.

How to save a new document?

import DBBrowser from "@nan0web/db-browser"
const db = new DBBrowser({
	host: "https://api.example.com",
	root: "/data/"
})
const result = await db.saveDocument("new-file.json", { test: "value" })
console.info("Save result:", result) // ← Save result: true

Writing Documents

Use PUT requests to update or overwrite existing documents.

How to write (update) a document?

import DBBrowser from "@nan0web/db-browser"
const db = new DBBrowser({
	host: "https://api.example.com",
	root: "/data/"
})
const data = [
	{ id: 1, name: "Alice Cooper", email: "[email protected]" },
	{ id: 2, name: "Bob Marley", email: "[email protected]" },
	{ id: 3, name: "Charlie Brown", email: "[email protected]" }
]
const result = await db.writeDocument("users.json", data)
console.info("Write result:", result) // ← Write result: { written: true }

Dropping Documents

Use DELETE requests to remove documents.

How to drop a document?

import DBBrowser from "@nan0web/db-browser"
const db = new DBBrowser({
	host: "https://api.example.com",
	root: "/data/"
})
const result = await db.dropDocument("new-file.json")
console.info("Drop result:", result) // ← Drop result: true

Directory Reading

DBBrowser supports reading directories and resolving relative paths.

How to read directory contents?

import DBBrowser from "@nan0web/db-browser"
const db = new DBBrowser({
	host: "https://api.example.com",
	root: "/data/"
})
const entries = []
for await (const entry of db.readDir(".")) {
	entries.push(entry.name)
}
console.info("Directory entries:", entries)
// Directory entries: ["users.json", "posts/first.json"]

Search Documents

Supports glob-style searching within remote structures.

How to search for documents?

import DBBrowser from "@nan0web/db-browser"
const db = new DBBrowser({
	host: "https://api.example.com",
	root: "/data/"
})
const entries = []
for await (const uri of db.find(uri => uri.endsWith(".json"))) {
	entries.push(uri)
}
console.info("Found JSON files:", entries)
// Found JSON files: ["/data/users.json", "/data/posts/first.json"]

Extract Subset

Create a new DBBrowser instance rooted at a specific subdirectory.

How to extract a subset of the database?

import DBBrowser from "@nan0web/db-browser"
const db = new DBBrowser({
	host: "https://api.example.com",
	root: "/data/"
})
const subDB = db.extract("posts/")
console.info("Subset cwd:", subDB.cwd) // ← Subset root: data/posts/
console.info("Subset root:", subDB.root) // ← Subset root: data/posts/
console.info("Subset instanceof DBBrowser:", subDB instanceof DBBrowser)
// Subset instanceof DBBrowser: true

API

DBBrowser

Extends @nan0web/db.

  • Static Properties

    • FetchFn – Static fetch function used globally unless overridden.
  • Instance Properties

    • host – Base URL host.
    • timeout – Default timeout for requests (ms).
    • fetchFn – Per-instance fetch handler.
  • Methods

    • ensureAccess(uri, level) – Validates access mode for a URI.
    • fetchRemote(uri, requestInit) – Performs remote fetch with timeout handling.
    • load() – Loads the root index.
    • statDocument(uri) – Fetches metadata via HEAD request.
    • loadDocument(uri, defaultValue) – Fetches and parses a document.
    • saveDocument(uri, document) – Saves a new file using POST.
    • writeDocument(uri, document) – Updates/overwrites file using PUT.
    • dropDocument(uri) – Deletes a file using DELETE.
    • extract(uri) – Creates a new DB subset rooted at the URI.
    • readDir(uri) – Reads directory contents with index loading support.
    • static from(input) – Instantiates or returns existing DBBrowser instance.

All exported classes should pass basic test to ensure API examples work

Java•Script

Uses d.ts files for autocompletion

CLI Playground

How to run DBBrowser demo?

git clone https://github.com/nan0web/db-browser.git
cd db-browser
npm install
npm run play

Contributing

How to contribute? - check here

License

How to check license ISC? - check here