Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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`

Required

store 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`

Required

name of the item to be saved

###### value

Type: `string`

Required

value 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`

Required

name of the item saved

#### .remove(input)

Returns a `promise`

Remove an item saved on local store

##### input

Type: `string`

Required

name 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)