You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
README.md
typescript/storage
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
|
2 years ago | |
---|---|---|
config | 2 years ago | |
doc | 2 years ago | |
src | 2 years ago | |
.editorconfig | 2 years ago | |
.gitignore | 2 years ago | |
README.md | 2 years ago | |
cli.ts | 2 years ago | |
deps.server.ts | 2 years ago | |
deps.testing.ts | 2 years ago | |
deps.ts | 2 years ago | |
mod.ts | 2 years ago | |
run | 2 years ago | |
tsconfig.json | 2 years ago |