Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bukinoshita/save-local
Save stuff locally
https://github.com/bukinoshita/save-local
save save-local save-me storage store
Last synced: about 2 months ago
JSON representation
Save stuff locally
- Host: GitHub
- URL: https://github.com/bukinoshita/save-local
- Owner: bukinoshita
- License: mit
- Created: 2017-08-25T19:25:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-03T12:18:27.000Z (about 2 years ago)
- Last Synced: 2024-10-10T16:07:30.327Z (2 months ago)
- Topics: save, save-local, save-me, storage, store
- Language: JavaScript
- Homepage:
- Size: 174 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# save-local [![Build Status](https://travis-ci.org/bukinoshita/save-local.svg?branch=master)](https://travis-ci.org/bukinoshita/save-local)
> Save stuff locally
## Install
```bash
$ yarn add save-local
```## Usage
```js
const SaveLocal = require('save-local')const saveLocal = new SaveLocal('store')
// you must call saveLocal.init() to initialize the instance
await saveLocal.init()saveLocal.set({ name: 'token', value: 'my-token' })
saveLocal.get('token').then(value => console.log(value))
// => my-token
```## API
### SaveLocal(input)
Returns a `constructor`
#### input
Type: `string`
Requiredstore name
### methods
#### .init()
Returns a `promise`
Initializes the local store
#### .set([options])
Returns a `promise`
Save and [encrypt](https://github.com/bukinoshita/caesar-encrypt) an item on local store
##### options
Type: `object`
Required###### name
Type: `string`
Requiredname of the item to be saved
###### value
Type: `string`
Requiredvalue of the item to be saved
#### .get(input)
Returns a `promise`
Get and [dencrypt](https://github.com/bukinoshita/caesar-encrypt) an item saved on local store
##### input
Type: `string`
Requiredname of the item saved
#### .remove(input)
Returns a `promise`
Remove an item saved on local store
##### input
Type: `string`
Requiredname of the item saved
#### .list()
Returns a `promise`
Get an array with all `names` and `values`
## Related
- [save-me](https://github.com/bukinoshita/save-me) — CLI for this module
- [git-labels](https://github.com/bukinoshita/git-labels) — Creating Github issue labels
- [git-labels-cli](https://github.com/bukinoshita/git-labels-cli) — Creating Github issue labels CLI## License
MIT © [Bu Kinoshita](https://bukinoshita.io)