Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lowdb-titanium-adapter

Build Status Published Version Published Downloads

Titanium SDK adapter for the LowDB embedded database.

You can use this library to persist LowDB databases inside Titanium applications using the Titanium API. Everything else operates normally as LowDB would do in any other environment, so see their repository for further information.

Usage

This module is on npm, so feel free to grab from there (as well as lowdb):

$ npm i lowdb lowdb-titanium-adapter

You can then configure it inside your application pretty easily, as the API is still synchronous for the time being:

// Load our modules
const low = require("lowdb");
const TitaniumAdapter = require("lowdb-titanium-adapter");

// Initialize the database to write to my-database.json
const adapter = new TitaniumAdapter("my-database.json", {
  // Describe the default schema.
  //
  // This will be used as the "base" state for your database. See the
  // LowDB documentation for more information. You can also handle this
  // by calling the `defaults()` method on your database instance.
  defaultValue: {},
});

// Create the database instance.
//
// This requires an async context, so you need to use a function
// as shown below until we can use `await` in the main `app.js`.
let db;
async () => (db = await low(adapter));

There is also a more complete example app available - just remember to run npm install before you try to run it. For any further usage, check out the LowDB docs as the API is exactly the same.

About

Titanium SDK adapter for the LowDB embedded database

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages