{"library":"pro.db","title":"Pro.db","description":"pro.db is a lightweight, easy-to-use database package designed for simple data storage, primarily in Node.js environments. It operates by storing data as JSON objects within local files, functioning as a file-based key-value store. The current stable version is 3.0.8. Its primary differentiator lies in its simplicity and direct API for common database operations like setting, getting, deleting, and manipulating numeric values or arrays within the stored JSON structure. The package appears to follow an as-needed release cadence, focusing on stability for its core features, and is particularly suited for small-scale applications or Discord bot development where a full-fledged relational database might be overkill. It does not require external database server setup, relying solely on local file system operations.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install pro.db"],"cli":null},"imports":["const db = require('pro.db');","const { set, get } = require('pro.db');","import db from 'pro.db';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const db = require('pro.db');\nconst path = require('path');\nconst fs = require('fs');\n\nconst dbFilePath = path.join(__dirname, 'database.json');\n// Ensure the database file exists or is created before operations\nif (!fs.existsSync(dbFilePath)) {\n  fs.writeFileSync(dbFilePath, '{}', 'utf8');\n}\n\n// Set a value\ndb.set('user:123:name', 'Alice');\ndb.set('user:123:age', 30);\ndb.set('products', [{ id: 1, name: 'Laptop' }, { id: 2, name: 'Mouse' }]);\n\nconsole.log('User name:', db.get('user:123:name'));\nconsole.log('Products:', db.get('products'));\n\n// Add to a numeric key\ndb.add('user:123:age', 5);\nconsole.log('New age:', db.get('user:123:age'));\n\n// Push to an array key\ndb.push('products', { id: 3, name: 'Keyboard' });\nconsole.log('Updated products:', db.get('products'));\n\n// Check if a key exists\nconsole.log('Has user:123:name?', db.has('user:123:name'));\n\n// Delete a key\ndb.delete('user:123:name');\nconsole.log('User name after delete:', db.get('user:123:name'));\n\n// Fetch all data\nconsole.log('All data:', db.fetchAll());\n\n// Example of backup (create a dummy backup file)\ndb.backup('my_backup_file');\nconsole.log('Backup initiated (check your file system for my_backup_file.json)');\n\n// Caution: db.reset() will delete all data.\n// Uncomment to clear the database:\n// db.reset();\n// console.log('Database reset. All data removed.');","lang":"javascript","description":"This example demonstrates common CRUD operations (set, get, add, push, delete) with pro.db, including checking key existence, fetching all data, and creating a backup file, highlighting its synchronous nature and file-based storage.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}