- Notifications
You must be signed in to change notification settings - Fork0
NaturalCycles/github-db
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
GitHub branch as a Database
Store your data for free in GitHub repo branch. Similar togh-pages
, but for data.
ImplementsCommonDB interface.
Store as*.ndjson
(newline-delimited json), or*.ndjson.gz
(gzipped), or*.sqlite
(binary).
Push to preserve git commit history or force-push to reset history and only store the recent state.
constdb=newFileDB({plugin:newGithubPersistencePlugin({token:'YOUR_GITHUB_TOKEN',repo:'NaturalCycles/github-db',}),})constitems=[{id:'id1',a:'a1'},{id:'id2',a:'a2'},]awaitdb.saveBatch('TEST_TABLE',items)
It will create, commit and pushdata/TEST_TABLE.ndjson
file to the repo/branch that you'vespecified (branch defaults togh-data
, similarly togh-pages
).
Next saves will be either new commits, or force-push of new commit over previous (withforcePush: true
option).
Currently, it needs some preparation steps to work (create empty branch), described further down.
Replacegit@github.com:NaturalCycles/github-db.git
with your repo.
Replacegh-data
with the desired branch name (butgh-data
is the default).
mkdir data && cd datagit clone git@github.com:NaturalCycles/github-db.git ./git checkout --orphan gh-datagit reset --hardgit commit --allow-empty -m "chore: init empty data branch"git push --set-upstream origin gh-data
- .ndjson.gzip option
- .sqlite option
- command to vacuum/force-push all commits in gh-data into one
About
GitHub branch as a Database