JSPM

  • Created
  • Published
  • Downloads 657
  • Score
    100M100P100Q115063F
  • License MIT

Simple, Fast JSON Database & You can read data from project to project

Package Exports

  • st.db

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (st.db) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ST.db

NPM

  • Simple, Fast JSON Database & You can read data from project to project

Features

  • Multiple JSON Files
  • Simple and Easy To get started
  • System for reading data from one project to another

Getting Started

You can start install the package on your project:

npm i st.db@latest

You can update to a newer version to receive updates using npm.

npm update st.db

Then Start define it like this:

const Database = require('st.db')
const db = new Database('FileName')//You can write the name you want

Important Notes

  • Auto understands json without typing .json in the path
  • For the Database class, you can pass in a parameter to set a file rather than using the default file!
  • If the file dosen't exist, it will create it
  • Path automatically set to ./

How do you name the basic folder name to the name you want?

  • Simple example of a method
const Database = require('st.db')
const db = new Database(`guilds`,{
  path: 'FolderName',
})
  • FolderName Enter the name of the folder in which you want to store the files
  • Note : If you don't do this, it will create a folder called ST.db to store the files

Set / Push Functions Examples

var object1 = {name: "Shuruhatik#0001", id: 742070589212327947}
db.set('Profile', object1); /* Profile: {name: "Shuruhatik#0001", id: 742070589212327947} */

var example1 = ['eg', 'ps']
db.set('Array', example1); /* example1: ['eg', 'ps'] */

Get / All Functions

db.get('profile'); // Get the value of the data
db.all(); // Fetches everything in the database

Remove Function

db.remove('Array', 'element3'); // Removing something from an array using value/index

Clear Function

db.clear(); // Clears everything from the database

Maths Functions

  • You must have a registered number in order to perform the calculation
var newEco = db.math("credits", "+", 10); // Adds 10 to the data (without set it), You Can Use [+,-,*,/]
db.set(`credits`, newEco) // set "credits": 5

Multiple Files

  • Example
const Database = require('st.db');

const bot = new Database('bot-config');
const servers = new Database('servers-config');
const users = new Database('users');

servers.set('guilds', '800060636041314375'); // servers-config.st file
bot.set('prefix', '$'); // bot-config.st file
users.set('blacklist_742070589212327947', true); // users.st file

System for reading data from one project to another

  • The data you record is stored in your own api, and the api is like that
http://localhost/Filename
  • localhost Type in the URL for your project
  • Filename Type the filename without the folder extension and without the json syntax
https://YouName.ProjectName.repl.co/Filename
  • Here is an example URL for repl it

How can I read data in another project?

  • Very simply, you are now data that has become an api, which you can read what is in it using the fetch package

Any bug or suggestion !

  • Contact With Me Discord: Shuruhatik#0001
  • or Discord Server ST Studio

ST STudio

License