Cbor-DB
An embedded database for typescript and nodejs. Built as a tiny wrapper around level using borc for encoding.
Overview
Cbor-DB is a performant database designed for embedded projects and low traffic web apps. It uses cbor for encoding instead of json which enables smaller storage size as well as storage of arbitrary blobs.
Cbor-DB is loosely based on Depot-DB, like Depot-DB, it has a different, yet familiar query language. Typescript.
In cbor-db the "where" is a function that is passed all of the documents in the db.
If the function returns true, the document is added to the collection, otherwise it is ignored. This is simple and yet performs well thanks to the use of streams.
The same goes for "sort". The sort function is passed two documents ("a" and "b") and returns a number determining which one goes first. If the sort function returns a number greater than zero "a" is at a higher index than "b", less than zero and "b" comes first. If it returns 0 they "a" and "b" equivalent.
Installation
npm i --save cbor-db
Basic Usage
// Define a document type.// All documents must have a readonly id field// that is of type string | number // You can also create an in memory DB that// uses memdown. Useful for development and testing. // Store some peoplepeople.putpeople.putpeople.putpeople.put // Query people // Find a person by their key (rejects if person is not found)
API Docs
Full API documentation can be found here