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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@37o1/httpdb

v1.1.0-stable

Published

TypeScript/JavaScript http based database

Downloads

21

Readme

HttpDB

An extension to LW-DB that adds query and lan use

HttpDB is a wrapper module for lw-db that allows multiple nodejs processes and compatible apps to access one database without the need of process synchronization. It also allows multiple computers to access the same database, however I do not advise doing that.

Setup

ES5

const { dbserver, dbclient } = require("httpdb");

const server = new dbserver("path/to/db/folder", true); // set up the database server
const client = new dbclient(server.accessToken); // use client to access the database

ES6

import { dbserver, dbclient } from "httpdb";

const server = new dbserver("path/to/db/folder", true);
const client = new dbclient(server.accessToken);

You can define the client in any process or computer you wish.

In order to access a remote database you need to be able to establish a TCP connection between the two machines. Setting up a local database for multiple machines is fine if you trust the devices and their users. You can set up muliple databases for multiple users if you want to set up granular access control.

If you want to extend security I advise you to do somthing like the following:

const server = require("http").createServer();
const dbserver = new require("httpdb").dbserver("path/to/db/folder", false);

server.on("request", (req, res) => {

    var passed = false;
    
    // here you canb implement your own security/access-control system
    // set passed to true is security checks passed

    if (passed) dbserver.handle(req, res);
});

Notes

This module purely uses headers for client to server transmit Make sure to set the max header size to a high value if you expect the client(s) to write a lot of data to a single file

Reserved headers

token: accessToken action: action flag data: strigified JSON data

lw-db

The underlying module of httpdb is lw-db, a node:fs wrapper module! This module is a pure JSON database that works locally and does not ecrypt data. Make sure to implement your own data encryption medthod.

Disclaimers

This module DOES NOT ENCRYPT DATA! Not in transmit and neither when saving. This module DOES NOT BACK UP!

THIS MODULE IS IN ACTIVE DEVELOPMENT! I AM NOT LIABLE IN ANY WAY FOR ANY OR FORM FOR ANY DATA LEAK OR DATA LOSS!