tk-storage ========== [![pipeline status](https://gitlab.com/thunderk/tk-storage/badges/master/pipeline.svg)](https://gitlab.com/thunderk/tk-storage/commits/master) [![coverage report](https://gitlab.com/thunderk/tk-storage/badges/master/coverage.svg)](https://gitlab.com/thunderk/tk-storage/commits/master) [![npm version](https://img.shields.io/npm/v/tk-storage.svg)](https://npmjs.com/tk-storage) [![npm size](https://img.shields.io/bundlephobia/min/tk-storage.svg)](https://bundlephobia.com/result?p=tk-storage) About ----- Javascript/Typescript persistent storage, with key-value stores as foundation. Typescript definitions are included. Issues can be reported on [GitLab](https://gitlab.com/thunderk/tk-storage/issues). Install ------- Import in node: ```shell npm install tk-storage ``` ```javascript import { getLocalStorage } from "tk-storage"; const storage = getLocalStorage("myapp"); ``` Import in browser: ```html ``` ```javascript const storage = tkStorage.getLocalStorage("myapp"); ``` Use --- To get a storage locally persistent (saved in browser data or on disk for Node.js): ```javascript 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): ```javascript 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" ```