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

helixia.db

v2.0.2

Published

A lightweight and high-performance JSON-based database module for Node.js with advanced features including backup and mathematical operations.

Downloads

25

Readme

🔹 helixia.db 2.0.2

helixia.db here with new features to make managing your JSON-based database easier and more efficient!

🔧 What does it do?

HelixiaDB provides a simple and high-performance solution for managing JSON files as databases. It’s designed to be user-friendly and effective for various data management tasks.

🚀 Getting Started

  • Install the package with npm:
npm install helixia.db
  • Initialize your database:
const { HelixiaDB } = require('helixia.db');
const db = new HelixiaDB(/* file.json */);

// If no file is specified, HelixiaDB will create a 'database.json' file by default.

✨ Example Usage

Here are some examples to get you started:

const { HelixiaDB } = require('helixia.db');
const db = new HelixiaDB(/* file.json */);

// Set / Push Functions Examples

const object1 = { key: true, key2: "true" };
db.set('Object', object1); // Object: { key: true, key2: "true" }

const array1 = ['element', 'element2'];
db.set('Array', array1); // Array: ['element', 'element2']

db.push('Array', 'element3'); // Array: ['element', 'element2', 'element3']

// Object & Array Fetch

db.fetchObject('Object', 'key'); // key: true

db.fetchArray('Array', 1); // element2

// Fetch / Get Functions

db.fetch('data'); // Fetches the value of 'data'

db.get('data'); // Same as fetch(), retrieves the value of 'data'

db.all(); // Fetches all data in the database

// Remove / Delete Functions

db.remove('data'); // Removes 'data' from the database

db.delete('Array', 'element3'); // Array: ['element', 'element2']

db.deleteKey('Object', 'key'); // Object: { key2: "true" }

db.deleteEach('data'); // Deletes all occurrences of 'data'

// Clear / Destroy Functions

db.clear(); // Clears all data from the database

db.destroy(); // Deletes the database file and clears all data

// Boolean Functions

db.has('data'); // Returns true if 'data' exists, otherwise false

// Math Functions

db.math('counter', '+', 5); // Adds 5 to 'counter'

db.math('counter', '-', 3); // Subtracts 3 from 'counter'

🔢 Math Function

Perform mathematical operations on numeric values:

const { HelixiaDB } = require('helixia.db');
const db = new HelixiaDB(/* file.json */);

db.set('counter', 15);

// Math Operation

const newCounter = db.math('counter', '-', 10); // Result: 5

db.set('counter', newCounter); // Updates 'counter' to 5

📂 Multiple Files

Manage multiple files with ease:

const { HelixiaDB } = require('helixia.db');

const botDB = new HelixiaDB('bot-config.json');
const serverDB = new HelixiaDB('servers-config.json');
const userDB = new HelixiaDB('users.json');

serverDB.push('servers', '800060636041314375'); // servers-config.json

botDB.set('prefix', '#'); // bot-config.json

userDB.set('whitelist_747430301654974546', true); // users.json

💾 Data Backup

Backup and restore your data effortlessly:

  • Set a backup file:
const { HelixiaDB } = require('helixia.db');
const db = new HelixiaDB();

db.createBackup('backup.json'); // Creates a backup file 'backup.json'
  • Load from a backup:
const { HelixiaDB } = require('helixia.db');
const db = new HelixiaDB();

db.restoreBackup('backup.json'); // Restores data from 'backup.json'