filodb

0.0.1 • Public • Published

FiloDB

FiloDB is a lightweight JSON file-based database built with Node.js. It’s ideal for small projects, prototyping, CLI tools, or educational purposes where a full database engine is not necessary.

📦 Installation

npm install filodb

🚀 Usage

import FiloDB from 'filodb';

const db = new FiloDB('./myDB.json'); // Relative to the project root (where package.json is)

await db.insert({ name: 'Alice' }, { name: 'Bob' });

const result = await db.get({ name: 'Alice' });
console.log(result);

await db.update({ name: 'Alice' }, { name: 'Eve' });

await db.delete({ name: 'Bob' });

📚 API

🔁 Return Values

Keep in mind that every method, except for Zenith.prototype.get returns the FiloDB instance, allowing method chaining.

new FiloDB(path?: string)

Creates a new instance. If the file doesn't exist, it will be automatically created.

insert(...data: Record<string, any>[])

Inserts one or more records.

get(query: Record<string, any>, limit?: number)

Returns an array of records matching the query. Optionally limit the number of results.

update(query: Record<string, any>, updatedData: Record<string, any>)

Updates all records matching the query with the given data.

delete(query: Record<string, any>)

Deletes all records matching the query.

📄 License

This project is licensed under the MIT License. See LICENSE for details.

Readme

Keywords

Package Sidebar

Install

npm i filodb

Weekly Downloads

72

Version

0.0.1

License

MIT

Unpacked Size

8.43 kB

Total Files

6

Last publish

Collaborators

  • sebastian-goat