Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ElCholoGamer/directory.db

Flexible, elegant and blazing-fast data storage.
https://github.com/ElCholoGamer/directory.db

database npm-package typescript

Last synced: about 2 months ago
JSON representation

Flexible, elegant and blazing-fast data storage.

Awesome Lists containing this project

README

        

# directory.db · ![Build status][build]

Flexible, elegant and blazing-fast data storage.

## Installation

Using npm:

```
$ npm i directory.db
```

Using Yarn:

```
$ yarn add directory.db
```

## Example usage

```js
import DirectoryDB from 'directory.db'; // ES Module
const DirectoryDB = require('directory.db').default; // CommonJS

// Create a database
const db = new DirectoryDB('./storage/user_data');

// Get a collection from the database
const users = db.getCollection('users');

// Get a document by UUID
const someUser = users.findByUUID('ee5dc2da-3211-4894-b0bb-7bb03fc1d0a0');
const username = someUser.get('username'); // Get a document property

// Get all documents that match a filter
const dogOwners = users.find({ pet: 'dog' });

// Insert a new document
const newUser = users.insertNew();
newUser.set('username', 'Deez_Nuts');
newUser.set('password', '123456');
newUser.set('pet', 'cat');
```

[build]: https://github.com/ElCholoGamer/directory.db/workflows/Build/badge.svg