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

flaster-db

v1.0.1

Published

Flaster-DB is a database for storing and retrieving data

Downloads

16

Readme

Flaster-DB

Performance at its best! Uses JSON to store data.

npm i flaster-db@latest

Database Examples

const Database = require('flaster-db')
//                                      Folder
const db = new Database.Database('./Local-Database-Folder', {
    backup: {
        enabled: true,
        name: 'backup.json',
        path: './Backup-Local-Database-Folder',
        interval: 900000,
    },
    memory: {
        enabled: true,
        saveinterval: 30000,
    },
    cli: true, // When true type help in console for help
    deep: true, // The dot notation that the world needs is here
    file: 'Data.json' // The File to store Database
})

db.set("Data", "World");

// Get data
db.get("Data"); // World

// Delete data
db.delete("Data");

db.get("Data"); // undefined
db.has("Data"); // false

db.set("Just_a_number", 10); // 10

db.add("Just_a_number", 2); // 12

db.subtract("Just_a_number", 6); // 6

db.set("array", [ "apple" ]);

// db.push() creates an array if it doesn't exist
db.push("array", "orange"); // [ "apple", "orange" ]

// Remove element from array
db.remove("array", "apple"); // [ "orange" ]

db.type("array"); // Array

db.keys(); // ["Just_a_number", "array"]

db.values(); // 6, ["orange"]

db.clear(); // {} 

db.save(); // Saves the database

db.size(); // Returns Database size

db.reload(); // Reloads the Database from disk

db.data(); // Returns the whole Database

Server-side Database setup

const Database = require('flaster-db');
//                                          Folder
const db-server = new Database.Server('./Database-folder-name', {
    servertype: 'master' // Choose Master
    port: 5555 // Port
})

Client-side Database

const Database = require('flaster-db');

//                              IP Address
const db = new Database.Client('localhost', {
    dbname: 'filename', // Database Name
    username: "username", // Username
    password: 'password', // Password
    port: 5555 // Port
})

db.set("Data", "World");

// Get data
await db.get("Data"); // World

// Delete data
db.delete("Data");

await db.get("Data"); // undefined
await db.has("Data"); // false

db.set("Just_a_number", 10); // 10

db.add("Just_a_number", 2); // 12

db.subtract("Just_a_number", 6); // 6

db.set("array", [ "apple" ]);

// db.push() creates an array if it doesn't exist
db.push("array", "orange"); // [ "apple", "orange" ]

// Remove element from array
db.remove("array", "apple"); // [ "orange" ]

await db.type("array"); // Array

await db.keys(); // ["Just_a_number", "array"]

await db.values(); // 6, ["orange"]

db.clear(); // {} 

Change Log

+ Please check Database class. Changed where to give file and folder locations for it
+ Added in-Memory Database to Database class
+ Added CLI (Command Line Interface) to Database class
+ Added New functions to Database class 
    + save()
    + reload()
    + data()
    + size()
+ Added Typings
+ Bug Fixes (Fixed my mistake while setting data as 0, false, null throws error), (Fixed the ability to type in console even while the cli is disabled)
- Removed my ugly console.logs from push
- Fixed issue when using get or has throws an error when the value is not found

Support

If you have any doubts join my Discord => Flaster-DB

Authors