wio.db is a Turkish-origin, human-readable database module for Node.js, currently in version 4.0.22. It serves as a lightweight, file-based key-value store, offering an alternative to packages like quick.db, and is frequently used in discord.js bot development. The library provides distinct implementations for JSON and YAML file formats, allowing developers to choose based on their data persistence preferences. While a specific release cadence is not explicitly stated, the project appears actively maintained with recent updates and bug fixes, indicated by its 4.x versioning. Key features include intuitive data manipulation methods for setting, getting, deleting, and querying data, alongside array and mathematical operations directly on stored values. It differentiates itself by emphasizing a human-readable storage format and offering both JSON and YAML options, rather than relying solely on a single serialization method.
npm install wio.dbVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize JSON and YAML database instances, perform common data operations like setting, getting, checking existence, pushing to arrays, performing math operations, retrieving all data, and deleting entries, using both JSON and YAML databases.
Upgrade your Node.js installation to version 12 or higher. For example, using nvm: `nvm install 16 && nvm use 16`.
Migrate your code to use alternative array manipulation methods or implement custom logic to check for array values. Consider using `<db>.pull` with a custom filter function or `<db>.get` and manual array iteration.
Review your code for any reliance on `JsonDatabase.DBCollection`. This property was internal and its removal indicates a refactoring of how database collections are managed. You may need to adapt your application logic if you were directly accessing it.
Utilize the new `<db>.info` property to get database statistics, which may include size-related information. If specific size metrics are required, you might need to calculate them manually based on the database file's size or content.
Change your import statement to use ESM syntax: `import { JsonDatabase, YamlDatabase } from 'wio.db';`Always instantiate database classes with `new`: `const db = new JsonDatabase({ databasePath: './data.json' });`Provide a valid string path for your database file: `const db = new JsonDatabase({ databasePath: './my-database.json' });`No dependency data recorded yet.