Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

GitHub branch as a Database

NotificationsYou must be signed in to change notification settings

NaturalCycles/github-db

Repository files navigation

GitHub branch as a Database

npmmin.gz sizecode style: prettier

Intro

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.

Example

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.

Prepare an empty branch to store your data

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

TODO

  • .ndjson.gzip option
  • .sqlite option
  • command to vacuum/force-push all commits in gh-data into one

[8]ページ先頭

©2009-2025 Movatter.jp