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

enhanced.db-new

v1.0.2

Published

Create a simple database using better-sqlite3, quick, fast and more enhanced!

Downloads

26

Readme

Enhanced.DB

Docs: docs.md

const db = require("enhanced.db");

// Set Options
const options = {
  clearOnStart: false,
  filename: "kek.sqlite",
};
// Setting clearOnStart true will clear the whole enhanced.sqlite. That would be false by default so if you dont need of that option no need of using options parameter!
// You can setup ur own custom file directory or location! But must be perfect for Sqlite Environment! It would be default to enhanced.sqlite!

// Will apply options to the default database table
db.options(options);

Now here comes some easy database methods!

db.set("foo", "bar"); // Will set value
db.get("foo"); // Will return bar
db.has("foo"); // Will return true
db.type("foo"); // Will return string
db.is("foo", "bar"); // Will return true

db.all(); // Will return all data
db.startsWith("f"); // Will send you the array of the data which key's starts with f

db.set("foo", 1);
db.add("foo", 2); // Value would be 3
db.subtract("foo", 2); // Value would be 2

db.delete("f"); // Will delete key 'f'
db.deleteAll(); // Will clear whole database! This will work only for default database table! If you are using custom table make sure that you use db.deleteTable()

db.set("foo", ["foo"]);
db.push("foo", "bar"); // Will push value to the array!
db.includes("foo", "bar"); // Will return true

Import Quick.DB data!

For those who wants to use this package but your Quick.DB has some important data! This is for you:

// Import quick.db
const quick = require("quick.db");

// Create db in enhanced.db
const db = require("enhanced.db");

db.importQuick(quick.all());

// Will console.log you *Finished Exporting*

Creating Tables

Create a custom table name which will be apart from the default database table

const db = require("enhanced.db");
const table = new db.Table("myTable", options);
// 'myTable' is your table name
// Options is same as you saw in the first 'clearOnStart' and 'filename'

table.set("foo", "bar"); // Will set value
table.get("foo"); // Will return bar

// Bascially all methods work also in Tables!

Some Utility

const db = require("enhanced.db");

db.version; // Returns current version of the package

Read EDB Sqlite files

Using this class you can read edb sqlite files and use import to import data!

// Import Read Constructor
const { Read } = require("enhanced.db");

// Set options if needed
const options = {
  table: "myCustomTable",
};
// Setting table will read that table of that file else it will read the default database one!

const data = new Read(filename, options);
// FIlename would be the name of the file to read

console.log(data.get());
// Will you return the the data selected as your options selected!

From Science Spot AKA Scientific Guy