A Koishi plugin that provides a simple, file-based database service using plain text files. Data is stored line-by-line as JSON strings, making it highly readable and easy to debug. It is designed for small-scale or prototype bots that do not require a full database engine. Current stable version: 1.2.0. Released as needed. Key differentiators: no dependencies beyond Koishi, zero parsing overhead, file-lock based concurrency safety.
npm install koishi-plugin-database-txtdbVerified import paths — ran on the pinned version, not inferred.
Install and use TxtDB plugin. Shows import, plugin registration, table creation, insertion, and query using Koishi database API.
Set path to a persistent location, e.g., './data/txtdb' inside your project directory.
Do not manually set ID field; let the database assign it.
Implement periodic cleanup or delete records using ctx.database.remove()
Use a full-featured database such as koishi-plugin-database-sqlite or koishi-plugin-database-mysql for production bots.
Use import TxtDb from 'koishi-plugin-database-txtdb' (no curly braces)
Run 'npm install koishi-plugin-database-txtdb' and ensure import matches package name exactly.
Set path to a directory the process can write to, or run with appropriate permissions.