lowdb-gh-adapter
Set your github repo as a backend for your lowdb instance
Usage
const low = const GhStorage = const adapter =
API
const adapter = GhStorage(opts)
Create an asynchronous adapter object, and then use it like any other asynchronous adapter with lowdb. Most of the options are mandatory:
file
: Required. A string indicating the path of the file where you want to store your data in your repo.json
extension is not mandatory but it is recommended. If this file is not present in your repo, it will be automatically created.repo
: Required. A string for the github repo where thefile
is stored.user
: Required. The github username that owns the github repo.token
: The personal access token for github. You can create tokens here, you only need therepo
permission. If this option is not provided, then you must provide ausername
andpassword
option for authentication.username
: A Github username who have access to therepo
specified. Not needed if you provided a token, if you don't, you will also need a password for this username.password
: A Github password for the username provided.branch
: Optional. Pass a string with the name of the branch where you want to save your data. If the branch is not specified, it will default to master. If the provided branch doesn't exists in the repo it will attemp to create it as a clone of master branch.
Disclaimer
Please note that this is not recommended for big scale projects. As lowdb limits section says, for bigger projects you should stay with solutions like MongoDB.
Specially for this adapter, you should have a look to Github Rate limit which has a quota of 5000 requests per hour.