LevelDOWN adapter for Firebase realtime database
A drop-in replacement for LevelDOWN that works with Firebase realtime database.
Can be used as a backend for LevelUP rather than an actual LevelDB store.
npm install --save firebase-down
var levelup = require('levelup')
var FirebaseDOWN = require('firebase-down')
var firebase = require('firebase/app')
require('firebase/database')
var config = {
apiKey: "apiKey",
databaseURL: "https://databaseName.firebaseio.com"
}
var firebaseApp = firebase.initializeApp(config)
var firebaseDown = FirebaseDOWN(firebaseApp)
var db = levelup('level', {db: firebaseDown})
Returns a constructor function that can be passed to levelup
, implements the abstract-leveldown
interface. firebaseApp
should be an instance of firebase.app.App
.
Call levelup with var db = levelup(location, {db: firebaseDown})
where location
should be a string path to a key in a firebase database, e.g. /path/to/key
. The leveldown database will be stored under this key.
PRs accepted.
Small note: If editing the Readme, please conform to the standard-readme specification.
MIT © Gregor MacLennan