dev-database
v0.0.2-beta
Published
Database for discord bots/developers
Downloads
4
Maintainers
Readme
Dev-Database
A Lightweight JSON File-Based Database for Development
Overview
'Dev-Database' is a simple npm package that provides a straightforward way to perform database operations using JSON files. It's designed to be lightweight and suitable for small-scale development projects, making it easy to store and retrieve data.
Installation
To use 'Dev-Database' in your project, install it using npm:
npm install dev-database
Getting Started
Create an instance of 'DevDatabase' by providing the path to your JSON file. Here's a quick example:
const DevDatabase = require('dev-database');
// Create an instance of DevDatabase with the file path
const db = new DevDatabase('database.json');
// Example usage
db.setData('key1', 'value1');
console.log(db.getData('key1')); // Output: 'value1'
Methods
'setData(key, value)' Set a key-value pair in the database.
db.setData('key', 'value');
'getData(key)' Retrieve the value associated with a key from the database.
const value = db.getData('key');
'deleteData(key)' Delete a key-value pair from the database.
db.deleteData('key');
Warning!
If the JSON file doesn't exist initially, the package will create an empty database.
Contact Me/Need Help?
Contact me in my Discord Developers Server https://discord.gg/Ym5V2DB6sk .