A high-resolution local database that uses precise algorithms to easily record data in local files within a project with persistent JSON and YAML support designed to be easy to set up and use

Overview

discord.js

NPM Downloads npm Version Types

Powered by Enormous

About

A high-resolution local database that uses precise algorithms to easily record data in local files within a project with persistent JSON and YML support designed to be easy to set up and use

  • Beginner friendly
  • Easy to use
  • Key-Value like interface
  • Database files inside and outside the project
  • Supports Style Array or Objects storage (edited)
  • Supports JSON and YML storage
  • Support encryption with password
  • Quick to respond, read and write
  • Support Events

Installation

Install with npm / yarn / pnpm:

npm install st.db@beta
yarn add st.db@beta
pnpm add st.db@beta

Usage

// Using Node.js `require()`
const { Database } = require('st.db');

// TypeScript/ES Module support
import { Database } from 'st.db';

Links

Examples

Example of constructor

  • new Database(path: string, options? : DatabaseOptions)
// JSON Database
const json_db = new Database("database.json") //Set by default ".json"

// YAML Database
const yaml_db = new Database("database.yaml") // or ".yml"

//Database in files from outside the work project
const db_outside_project = new Database("C:/Users/pc/Desktop/database.yml",{
	 pathOutsideTheProject:true//If you activate the "pathOutsideTheProject" option, you will be able to type any path from your computer in the "path".
})

// Options
const db_with_options = new Database("database.json",{
	storageStyle: Database.Style.Array,// default = Database.Style.Object
	encryption:{password:"ea6d4h4j"}//If you want to encrypt data with a password
})

Example of methods

  • Note: Inside all the methods that accept or accept key or value are both, you can put them as Partmeter 1 = key and Parmeter 2 = value or as Partmeter 1 object {key,value}
db.on("ready", () => console.log("Database Ready!"));
db.on("addElement", (elementInData,value) => console.log(`New "${elementInData.ID}" elementb Value: ${value}`))
db.on("editElement", (elementInData,new_value,old_value) => {
	console.log(`Edit "${elementInData.ID}" element New Value: ${new_value} and Old value: ${old_value}`)
})
//Set element in database
db.set({key:"settings",value:{theme:"dark",fontSize:10}})  return Promise<ElementInData>

//Checking an item from the database if it exists or not
console.log(db.has({key:"settings"})) //or console.log(db.has("settings"))

//To get the value type of a given key element
console.log(db.type({key:"settings"})) //or console.log(db.type("settings"))

//Delete element from database
db.delete({key:"settings"}) //or db.delete("settings")

// Returns everything from the database
console.log(db.all()) //Returns all elements in Database
console.log(db.valuesAll())//Return all values from the database
console.log(db.keysAll())//Return all keys from the database

// Fetches everything and sorts by given target
db.includes({key:"tti"});// It fetches the values ​​containing this value
db.startsWith({key:"setti"});// It fetches values ​​starting with this value
db.endsWith({key:"ings"});// It fetches values ​​ending with this value

// Array Methods
db.push("skills",["html","javascript"]) // To push an element to an array into data
db.unshift("skills","typescript") // To unshift an element to an array into data
db.shift("skills") // Removes the first element of the array
db.pop("skills") // Removes the last element of the array
db.pull("skills","javascript")

// Math Methods
db.math({
  key:"coins",  
  operator:"+",  
  value:100, 
  goToNegative:false
})//or db.math("coins", "+", "100", false)

db.subtract({key:"coins", value:50})// To subtract from value
db.add({key:"coins", value:50})// To add from value
db.multiply({key:"coins", value:2})// To multiply from value
db.double({key:"coins"})//To double from value

// Methods for controlling the database, reloading and deleting items
db.destroy()//Destroy the database
db.deleteAll()//Delete all data
db.clear()//Clear all data
db.reload()//Reload the database
console.log(db.uptime())//Returns database connection uptime 
console.log(db.fileSize())//To get the file size

Help

If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official Discord Server .

Did you find it difficult to use?

You can see the Documentation of the st.db package to know all the details

License

CC BY-NC-ND 4.0

You might also like...

Deduplication tool for pnpm-lock.yaml files

pnpm-deduplicate Remove duplicate dependencies from pnpm-lock.yaml. This project is simple and not have many features. I see it as a temporary solutio

Jan 3, 2023

A simple, easy to use and extendible JSON database.

A simple, easy to use and extendible JSON database.

Newton ⚠️ This package is under active development: Compatibility and APIs may change. A simple, easy to use and extendible JSON database. Table of co

Dec 6, 2022

Free to use and not for sale. This repo uses scrape or data.json

Aine-MD This script is free, if caught sold, this script will be deleted immediately. Don't forget to follow my github Script ini gratis, Jika ketahua

Dec 30, 2022

Query for CSS brower support data, combined from caniuse and MDN, including version support started and global support percentages.

css-browser-support Query for CSS browser support data, combined from caniuse and MDN, including version support started and global support percentage

Nov 2, 2022

Simple modern JavaScript ES6 library that fetches JSON data into an HTML table which displays nicely within a Bootstrap 4 Card.

Simple modern JavaScript ES6 library that fetches JSON data into an HTML table which displays nicely within a Bootstrap 4 Card. Uses simplenotsimpler/modern-table library.

Feb 17, 2022

Piplup: decompile Playdate Pulp .pdx files back to .json project files

Piplup: decompile Playdate Pulp .pdx files back to .json project files This doesn't work yet: I still need to: convert the graphics (.pdt files) back

Mar 25, 2022

Use 1400+ 3dicons within Figma or Figjam files quickly

Use 1400+ 3dicons within Figma or Figjam files quickly

3dicons Figma plugin Use 1400+ 3dicons within Figma or Figjam files quickly. The icons can be searched and filtered by color and angle. Figma Communit

Dec 8, 2022

The Taste food web app is our JavaScript capstone project, Taste food is a web application based on an external food API, showing data about Italian foods and we used Used involvement API to record the different user interactions (likes, comments).

taste-food The Taste food web app is our JavaScript capstone project, Taste food is a web application based on an external food API TheMealDB, showing

Aug 10, 2022

Recompo is a free and open-source project that is designed for customizability and speed and is easy to use and powerful.

Recompo is a free and open-source project that is designed for customizability and speed and is easy to use and powerful.

About Recompo is a free and open-source project that is designed for customizability and speed and is easy to use and powerful Installation recompo is

Mar 20, 2022
Owner
Shuruhatik
I am Mohamed from Egypt, 😀 Some info about me. I have udemy certificates I am 16 years old and I live in Egypt and I use visual studio code for coding
Shuruhatik
Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all with IndexedDB. Perfectly suitable for your next (PWA) app.

BrowstorJS ?? ?? ?? Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all

Nullix 8 Aug 5, 2022
⚡ It is a simplified database module with multiple functions that you can use simultaneously with sqlite, yaml, firebase and json.

Prisma Database Developed with ?? by Roxza ⚡ An easy, open source database ?? Installation npm i prisma.db --save yarn add prisma.db ?? Importing impo

Roxza 21 Jan 3, 2023
A status monitor for Elite Dangerous, written in PHP. Designed for 1080p screens in the four-panel-view in panel.php, and for 7 inch screens with a resolution of 1024x600 connected to a Raspberry Pi.

EDStatusPanel A status monitor for Elite Dangerous, written in PHP. Designed for 1080p screens in the four-panel-view in panel.php, and for 7 inch scr

marcus-s 24 Oct 4, 2022
Add aliasing support to Vite from tsconfig.json or jsconfig.json files

Config to Alias Config to Alias adds aliasing support to Astro, JavaScript, TypeScript, and CSS files. Usage Install Config to Alias. npm install @ast

Astro Community 4 Mar 17, 2023
A simple way to share files and clipboard within a local network.

Shortcut Simple way to share files and clipboard with devices within a local network. Usage Run the ./shortcut executable. A browser window will be op

Dhamith Hewamullage 17 Mar 13, 2022
JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

JSON Visio is data visualization tool for your json data which seamlessly illustrates your data on graphs without having to restructure anything, paste directly or import file.

Aykut Saraç 20.6k Jan 4, 2023
Visualize and download JSON / YAML content

Graphize ?? Visualize and download JSON / YAML content in your browser Demo Key Features Preview your JSON / YAML documents instantly Pinch / Scroll Z

Varun A P 25 Dec 26, 2022
Generate a zodios (typescript http client with zod validation) from an OpenAPI spec (json/yaml)

openapi-zod-client Generates a zodios (typescript http client with zod validation) from a (json/yaml) OpenAPI spec (or just use the generated schemas/

Alexandre Stahmer 104 Jan 4, 2023
An Obsidian plugin to grab all yaml fields from all files into a dataframe

Metadataframe Metadataframe allows you to get all metadata from your vault into CSV file. With CSV in-hand, you can do any data analysis you want with

null 7 Sep 15, 2022
A custom action for setting GitHub Workflow environment variables with YAML configuration files.

yaml-env-action - A custom action for setting GitHub Workflow environment variables with YAML configuration files. Introduction yaml-env-action is a c

Piper Dougherty 3 Dec 13, 2022