Key/value storage, local or remote
Find a file
2021-09-16 23:22:24 +02:00
config Choose test server port in a range 2021-06-22 18:39:44 +02:00
doc Use oak instead of opine 2021-09-16 23:22:24 +02:00
src Use oak instead of opine 2021-09-16 23:22:24 +02:00
.editorconfig Port to deno 2021-06-22 16:10:17 +02:00
.gitignore Use oak instead of opine 2021-09-16 23:22:24 +02:00
cli.ts Use oak instead of opine 2021-09-16 23:22:24 +02:00
deps.server.ts Use oak instead of opine 2021-09-16 23:22:24 +02:00
deps.testing.ts Use oak instead of opine 2021-09-16 23:22:24 +02:00
deps.ts Use oak instead of opine 2021-09-16 23:22:24 +02:00
mod.ts Use oak instead of opine 2021-09-16 23:22:24 +02:00
README.md Use oak instead of opine 2021-09-16 23:22:24 +02:00
run Choose test server port in a range 2021-06-22 18:39:44 +02:00
tsconfig.json Port to deno 2021-06-22 16:10:17 +02:00

typescript/storage

Build Status

About

Javascript/Typescript persistent storage, with key-value stores as foundation.

Import

In deno:

import { getLocalStorage } from "https://js.thunderk.net/storage/mod.ts";

In browser:

<script type="module">
import { getLocalStorage } from "https://js.thunderk.net/storage/mod.js";
</script>

Use

To get a storage locally persistent (saved in browser data or on disk for Deno):

const storage = getLocalStorage("myapp");
await storage.get("key"); // => null
await storage.set("key", "value");
await storage.get("key"); // => "value"

To get a storage remotely persistent (saved on a compliant server):

const storage = getRemoteStorage("myapp", "https://tk-storage.example.io/", {
  shared: true,
});
await storage.get("key"); // => null
await storage.set("key", "value");
await storage.get("key"); // => "value"

Run a server for remote storage:

./cli.ts