Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whitfin/lowdb-titanium-adapter
Titanium SDK adapter for the LowDB embedded database
https://github.com/whitfin/lowdb-titanium-adapter
database json mobile nosql titanium-mobile titanium-sdk
Last synced: about 2 months ago
JSON representation
Titanium SDK adapter for the LowDB embedded database
- Host: GitHub
- URL: https://github.com/whitfin/lowdb-titanium-adapter
- Owner: whitfin
- License: mit
- Created: 2019-05-25T01:56:15.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-30T00:35:25.000Z (over 5 years ago)
- Last Synced: 2024-10-26T03:10:27.353Z (2 months ago)
- Topics: database, json, mobile, nosql, titanium-mobile, titanium-sdk
- Language: JavaScript
- Size: 7.98 MB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lowdb-titanium-adapter
[![Build Status](https://img.shields.io/travis/whitfin/lowdb-titanium-adapter.svg?label=unix)](https://travis-ci.org/whitfin/lowdb-titanium-adapter)
![npm](https://img.shields.io/npm/v/lowdb-titanium-adapter.svg)Titanium SDK adapter for the [LowDB](https://github.com/typicode/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):
```shell
$ 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:```javascript
// 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](example/) available - just
remember to run `npm install` before you try to run it. For any further
usage, check out the [LowDB](https://github.com/typicode/lowdb) docs as
the API is exactly the same.