Socket
Book a DemoInstallSign in
Socket

oak-lite

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oak-lite

A lightweight version of Oak, a write-only database with a publish-subscribe model

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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:

ParameterDescriptionRequiredDefault
dataDirectoryThe directory used by this database to store racksYesnone

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.

Keywords

oak

FAQs

Package last updated on 09 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts