csv-db is a lightweight, file-based database for Node.js, initially designed as a teaching aid for workshops requiring a simple data persistence layer. It stores data in plain CSV files, using newlines for row separation and semicolons for field separation. The current stable version, 0.2.2 (last published over eight years ago), relies on Promises for asynchronous CRUD (Create, Read, Update, Delete) operations, a significant evolution from its initial synchronous implementation. Its primary differentiators are extreme simplicity and direct file storage, making it suitable for minimal persistence needs, proof-of-concept applications, or educational contexts where understanding basic data storage is key. It lacks advanced database features such as indexing, complex querying, or transaction management. Due to its age and lack of updates, its release cadence is effectively nonexistent.
npm install csv-dbVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing `csv-db` with a file and column names, then fetching all records and a specific record by ID.
Rewrite data access operations to use Promises (e.g., `.then()`/`.catch()` or `async/await`).
Avoid using this package for new projects or production environments where security, stability, or modern language features are important. Consider actively maintained alternatives like `csv` or `fast-csv` for parsing/writing, combined with a more robust data storage solution.
Only use this package in single-threaded, single-process applications, or where write concurrency is strictly managed externally. Do not use for high-concurrency or mission-critical applications.
Ensure all input CSV files are formatted with semicolons as field separators or manually parse the CSV and feed structured data to the `insert`/`update` methods.
When updating, first `get` the existing record, merge the changes, then pass the complete merged object to `update`.
Ensure you are using CommonJS `const CsvDb = require('csv-db');` and instantiating with `new CsvDb(...)`.Verify the file path is correct and the Node.js process has read/write permissions for the file and directory.
Always chain a `.catch(err => console.error(err))` to `csv-db` promise calls or use `try/catch` with `async/await` to handle potential errors.
Ensure the CSV file uses semicolons as delimiters. If providing column names in the constructor, make sure they match the order and number of fields in the CSV.
No dependency data recorded yet.