https://github.com/jacoblincool/worker-gist
GitHub Gist as KV, for Cloudflare Workers. It helps to keep the number of KV write operation as low as possible.
https://github.com/jacoblincool/worker-gist
cloudflare gist github workers workers-kv
Last synced: 11 months ago
JSON representation
GitHub Gist as KV, for Cloudflare Workers. It helps to keep the number of KV write operation as low as possible.
- Host: GitHub
- URL: https://github.com/jacoblincool/worker-gist
- Owner: JacobLinCool
- License: mit
- Created: 2022-06-29T15:54:42.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-13T23:18:50.000Z (12 months ago)
- Last Synced: 2025-03-14T00:26:59.062Z (12 months ago)
- Topics: cloudflare, gist, github, workers, workers-kv
- Language: TypeScript
- Homepage: https://jacoblincool.github.io/worker-gist/
- Size: 114 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Worker Gist
GitHub Gist as KV, for Cloudflare Workers.
It is slower than KV, but it helps to keep the number of KV `write` operation as low as possible.
## Usage
```ts
import { GistStore } from "worker-gist";
const store = new GistStore(env.KV, env.PAT);
const logs = JSON.parse((await store.get("logs")) || "[]");
logs.push({ time: Date.now(), msg: "Something to log." });
await store.set("logs", JSON.stringify(logs));
```