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.
npm install pro.dbVerified import paths — ran on the pinned version, not inferred.
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.
For performance-critical applications, consider a database solution with asynchronous I/O or use pro.db for minimal, infrequent writes. Wrap calls in a worker thread if blocking I/O is unavoidable for heavy usage patterns.
Implement robust confirmation logic in your application code before invoking `db.reset()`. Ensure backups are performed regularly using `db.backup()`.
For Node.js projects, use `const db = require('pro.db');`. If you must use ESM, ensure your project is configured with `"type": "module"` in `package.json` and investigate specific interoperability solutions or use a bundler.Wrap `pro.db` operations in `try...catch` blocks to handle potential file system errors gracefully. For example, catching `EACCES` for permission denied errors.
Change your project or file to use CommonJS (`const db = require('pro.db');`) or transpile your ESM code to CJS before running. Alternatively, if your Node.js version supports it, you might be able to use dynamic import `import('pro.db').then(db => { /* use db */ });`.Ensure you are using `const db = require('pro.db');` for Node.js CommonJS environments. If using TypeScript, check your `tsconfig.json` for `esModuleInterop` and `allowSyntheticDefaultImports` or provide a custom module declaration.Ensure the user running the Node.js application has read and write permissions to the directory where the database file is stored. You may need to change directory permissions (e.g., `chmod 777 your-data-directory`) or run the application with elevated privileges (use with caution).
No dependency data recorded yet.