https://github.com/grazen0/directory.db
Flexible, elegant and blazing-fast data storage.
https://github.com/grazen0/directory.db
database npm-package typescript
Last synced: 8 months ago
JSON representation
Flexible, elegant and blazing-fast data storage.
- Host: GitHub
- URL: https://github.com/grazen0/directory.db
- Owner: Grazen0
- License: mit
- Created: 2021-02-02T21:43:18.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-02T23:10:52.000Z (about 5 years ago)
- Last Synced: 2024-10-02T18:36:51.757Z (over 1 year ago)
- Topics: database, npm-package, typescript
- Language: TypeScript
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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