RipDB
A 100% JavaScript embeddable JSON time series database.
API is unstable.
Name
The name "Rip" in RipDB is from Rip Van Winkle.
Why?
Often times it's useful to have data indexed by date/time. Examples of such data would be log data, stock data, etc. There are plenty of time series databases, however, none that I'm aware of that are embeddable.
RipDB is useful if you're building an Electron app and you don't want to recompile LevelUp for every target platform.
Design Goals
- No native modules, 100% embeddable.
- Super simple file format. Indexed (typically by day) newline delimited JSON (
.ndjson
) with two top level fieldsd
, andt
. - Simple interface. Node.js streams only to read or write.
Caveat Emptor
I don't maintain that this is a good idea, nor is even fast/efficient. This should be thought of as more of an experiment. If your data set is larger than 100 MB, you may be better served by another embeddable database or time series database.
Usage
Install
npm i --save ripdb
API
create()
create(path, [indexFn])
Parameters:
path
: The path directory to read / write a RipDB database.indexFn
: Optional function to use for indexing. Defaults to returning a path that indexes like${path}/YYYY/mm-dd.ndjson
. Files should easily fit in memory.
Returns: An instance of RipDB.
var ripdb = var db = ripdb
prototype.path
prototype.createReader()
Returns an instance of Readable stream used to read data from the database. Starts from the most recent.
var ripdb = var db = ripdbvar reader = db reader
Will support middleware, JSON revivers, etc.
prototype.createWriter()
Returns an instance of a Writable stream used to write data.
var ripdb = var db = ripdbvar writer = db writer
Will support middleware, JSON replacers, etc.
License
MIT
Copyright (c) JP Richardson