npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

oak-lite

1.0.0 • Public • Published

oak-lite

Build Status codecov npm Dependency Status devDependency Status

Oak-Lite is a lightweight version of Oak, a write-only database with a publish-subscribe model.

Getting Started

Install the oak-lite package into your project with npm.

npm install oak-lite --save

Use the oak-lite module in your project.

import Oak from 'oak-lite';
 
// Configure the database (see the configuration options)
let database = Oak.configure({
    dataDirectory: '/var/lib/myapp/oak'
});
 
// Select the 'counter' rack
let rack = database.selectRack('counter');
 
// Subscribe to the rack
let subscription = rack.subscribe(barrel => {
    // Print each barrel to the console
    console.log(barrel);
});
 
// Publish 3 barrels to the rack
rack.publish(1);
rack.publish(2);
rack.publish(3);
 
// Unsubscribe from the rack after 10 seconds
setTimeout(() => {
    subscription.unsubscribe();
}, 10 * 1000);

Configuration

The following parameters can be defined when configuring an Oak-Lite database:

Parameter Description Required Default
dataDirectory The directory used by this database to store racks Yes none

API

The public interface for oak-lite is defined in the API Guide.

Contributing

Pull requests are welcome! To get started, see the Contributing Guide.

install

npm i oak-lite

Downloadsweekly downloads

14

version

1.0.0

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability