# nuxt-storage

> 🛢 Utilities for easy read and write browser's storage in Nuxt.js project

Latest version **1.2.2** (published 2019-08-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install nuxt-storage
pnpm add nuxt-storage
yarn add nuxt-storage
bun add nuxt-storage
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2019-08-20 |
| First published | 2018-09-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 35.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 128 |
| Author | Irfan Maulana |
| Maintainers | irfan.maulana |
| Keywords | nuxt, nuxt-storage, browser-storage, local-storage, session-storage |

## Links

- npm: https://www.npmjs.com/package/nuxt-storage
- Repository: https://github.com/mazipan/nuxt-storage
- Homepage: https://github.com/mazipan/nuxt-storage#readme
- Issues: https://github.com/mazipan/nuxt-storage/issues
- npm.io page: https://npm.io/package/nuxt-storage

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2019-08-20
- 1.2.1 — 2019-05-07
- 1.2.0 — 2019-04-22
- 1.1.0 — 2019-03-21
- 1.0.9 — 2018-10-26
- 1.0.8 — 2018-10-02
- 1.0.7 — 2018-10-02
- 1.0.5 — 2018-09-27
- 1.0.4 — 2018-09-27
- 1.0.3 — 2018-09-27
- 1.0.2 — 2018-09-26
- 1.0.1 — 2018-09-26
- 1.0.0 — 2018-09-26

## README

# 🛢 Nuxt-Storage

[![License](https://img.shields.io/github/license/mazipan/nuxt-storage.svg?longCache=true)](https://github.com/mazipan/nuxt-storage) [![version](https://img.shields.io/npm/v/nuxt-storage.svg?maxAge=3600)](https://www.npmjs.com/package/nuxt-storage)
[![downloads](https://img.shields.io/npm/dt/nuxt-storage.svg?maxAge=86400)](https://www.npmjs.com/package/nuxt-storage) [![Travis](https://img.shields.io/travis/mazipan/nuxt-storage.svg?maxAge=86400)](https://travis-ci.org/mazipan/nuxt-storage)
[![codecov](https://codecov.io/gh/mazipan/nuxt-storage/branch/master/graph/badge.svg?maxAge=86400)](https://codecov.io/gh/mazipan/nuxt-storage) ![Dependencies](https://img.shields.io/david/mazipan/nuxt-storage.svg)

> Utilities for easy read and write browser's storage in Nuxt.js project

## Why I need this package?

In Nuxt, it's hard to play with browser's storage like `sessionStorage` and `localStorage`.
This package will help you handle client side storage with a simple API and with various useful additional features such as expiry.

## How to install and use

Install using NPM or Yarn

```bash
# NPM
$ npm i nuxt-storage
# Yarn
$ yarn add nuxt-storage
```

## Sample using this package

All API import

```js
import nuxtStorage from 'nuxt-storage';

nuxtStorage.localStorage.setData('key', 'value');
nuxtStorage.sessionStorage.setData('key', 'value');
```

Partial import

```js
// # for local storage
import { getData, setData } from 'nuxt-storage/local-storage';

// # for session storage
// import { getData, setData } from 'nuxt-storage/session-storage';

setData('key', 'value');
```

## API

| Method Name | Parameter                         | Default Value | Available Options |
|-------------|-----------------------------------|---------------|-------------------|
| getData     | `key` (type: String)              | Empty String  |  |
| setData     | `key` (type: String)              | Empty String  |  |
|             | `value` (type: any)               | Empty String  |  |
|             | `expiry` (type: Number)           | 5             |  |
|             | `expiryUnit` (type: String)       | m             | `s` = second, `m` = minutes, `h` = hour, `d` = day  |
| clear       | -                                 |               |  |

-----

Copyright © 2018 by Irfan Maulana

---
_Source: https://npm.io/package/nuxt-storage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
