# persistent-lim-storage

> extra-small library for creating a persistent limited storage

Latest version **4.0.7** (published 2019-06-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install persistent-lim-storage
pnpm add persistent-lim-storage
yarn add persistent-lim-storage
bun add persistent-lim-storage
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.7 |
| Published | 2019-06-10 |
| First published | 2019-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 3 |
| Unpacked size | 47.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alexey |
| Maintainers | alexeykol |

## Links

- npm: https://www.npmjs.com/package/persistent-lim-storage
- npm.io page: https://npm.io/package/persistent-lim-storage

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [sizeof](https://npm.io/package/sizeof.md) ^1.0.0
- [object-sizeof](https://npm.io/package/object-sizeof.md) ^1.4.0

## Recent versions

- 4.0.7 (latest) — 2019-06-10

## README

# TypeScript library starter

This is a small library to create a persistent limited storage for your project.

Use | import {Storage} from 'per-lim-storage' | to import a persistent limited storage.

Use | const *yourname* = new Storage(params); | to create an persistent limited storage. 

Use | const params = {
    limit: number,
    useLocalStorage: boolean,
    globalKey: string
} | to set the storage parameters.

Limit - amount of memory in bytes that you dont want to exceed, you can update limit later by setLimit(newlimit).
If you use local storage max limit you can set is 10mb.

useLocalStorage - true or false, do you want to use localStorage and sync it with your storage?

globalKey - special key for storage, library use this key to set data to localStorage.

Library functionality:
 
Storage.set(key: string, value: any) - set a node to your storage, and local storage.

Storage.remove(key: string) - delete node from local and your storage.

Storage.setLimit(limit: number) - to set a new limit for storage.

Storage.getDataFromLocalStorage() - get all data from local storage by the global key, init by default in constructor.

Storage.isFull() - is the storage full?

Storage.getFreeSpace() - return the count of bytes that availble in storage now.

Storage.get(key: string) - return the node value.

Storage.clearStorage() - delete all the key-value by globalKey in your and local storage.

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