https://github.com/fabiospampinato/ionstore
A very simple isomorphic key-value store with a Map-like API for persisting session data.
https://github.com/fabiospampinato/ionstore
isomorphic session simple storage store temp temporary
Last synced: 7 months ago
JSON representation
A very simple isomorphic key-value store with a Map-like API for persisting session data.
- Host: GitHub
- URL: https://github.com/fabiospampinato/ionstore
- Owner: fabiospampinato
- License: mit
- Created: 2023-08-03T15:17:59.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-24T16:28:49.000Z (over 1 year ago)
- Last Synced: 2024-11-01T00:25:21.429Z (8 months ago)
- Topics: isomorphic, session, simple, storage, store, temp, temporary
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# IonStore
A _very_ simple isomorphic key-value store with a Map-like API for persisting session data.
This module simply uses a temporary file under Node, and `sessionStorage` under a browser. Check out [`isostore`](https://github.com/fabiospampinato/isostore) if you need something a bit more sophisticated.
## Install
```sh
npm install --save ionstore
```## Usage
```ts
import IonStore from 'ionstore';// Creating a store, for temporary persistence
const store = new IonStore ( 'my-store' ); // The id of the store decides the name of the file on disk
store.has ( 'foo' ); // => false
store.set ( 'foo', 'some_string' ); // => store
store.get ( 'foo' ); // => 'some_string'
store.delete ( 'foo' ); // => true
```## License
MIT © Fabio Spampinato