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

locidb

v1.0.1

Published

Small and simple noSQL-like database module for NodeJS applications.

Downloads

4

Readme

lociDB

Intro

Small and simple noSQL-like database module for NodeJS applications.

This module lets you store an array of objects into simple plain text files as a JSON string. You dont need to stringify your objects first, lociDB does that for you (see usage below).

This noSQL-like database is perfect for your small NodeJS and Electron applications where you maby want to store some kind of user settings, to-do list etc for example.

See our wiki for more info and change log.

If you planing on storing >100MB of data this module is not for you.

Install

npm install --save locidb

Usage

const LociDB = require("locidb"); // Import the module.
const db = new LociDB(); // Create an instance of lociDB and create folder in users appData folder.
// const db = new LociDB("/path/to/destination", "mycooldb")  // You can also decide your self where to store lociDB database, table files and what name it should have.
// const db = new LociDB(undefined, "mycooldb")               // Create a lociDB database folder at default location but change the name.
// const db = new LociDB(app.getPath("userData"), "mycooldb") // For electron app developer. A lociDB database folder is created per auto inside you app config folder which is in users default appData folder.

// This is three example objects
let user = {
  name: "Mikael",
  age: 27,
  city: "Bohus",
  country: "Sweden"
};

let user2 = {
  name: "Kalle",
  age: 27,
  city: "Nol",
  country: "Norway"
};

let settings = {
  fontSize: 13,
  color: "#000",
  active: false
};

console.log(db.listTables()); // First list tables to see if there exists any already.

db.set("users", user);
db.set("settings", settings); // This will overwrite any data in the table and insert the value instead.

db.insert("users", user2); // Insert the object to the table at the end.

console.log(db.countRows("users")); // Count how many rows there is in a table.

console.log(db.get("users")); // Get all rows in the table as an array of objects and print it.
console.log(db.get("settings"));

console.log(db.getRows("users", "name", "Mikael")); // Get all rows in a table matching a key and a value as an array of objects.

console.log(db.dropRows("users", "name", "Mikael")); // Drop/delete specific rows in a table. Returns a number of total rows deleted.
console.log(db.dropTable("settings")); // Drop/delete a specific table. Returns true if a delete was made of false if not.
db.dropAll(); // Drop/deletes all tables. Only use if you know what you doing.

Testing

If you want to try some functions before using this module in your applications you can use the test.js file located in the root folder of the module and then run the file in your terminal with the command:

node ./test.js

or

npm run test

License

ISC Mikael Luxwarp Carlsson

Note

Feel free to contribute the way you want.