Чтобы настроить и использовать пакет quick.dbв Node.js, вы можете выполнить следующие действия:
Шаг 1. Установите пакет
npm install quick.db
Шаг 2. Требуйте пакет
const db = require('quick.db');
Шаг 3. Создайте базу данных и задайте данные
db.set('key', 'value'); // Set a value to a key
Шаг 4. Получение данных
const data = db.get('key'); // Retrieve the value associated with a key
console.log(data);
Шаг 5. Обновите данные
db.set('key', 'new value'); // Update the value associated with a key
Шаг 6. Удаление данных
db.delete('key'); // Delete a key-value pair
Шаг 7. Дополнительные методы
// Check if a key exists
const exists = db.has('key'); // Returns a boolean
// Increment a numeric value
db.add('key', 5); // Adds 5 to the existing value
// Decrement a numeric value
db.subtract('key', 3); // Subtracts 3 from the existing value
// Fetch all key-value pairs in the database
const allData = db.all(); // Returns an array of objects
// Fetch all the keys in the database
const keys = db.keys(); // Returns an array of keys
// Fetch all the values in the database
const values = db.values(); // Returns an array of values