# app-local-store

> Easily persist app data.

Latest version **1.0.6** (published 2022-06-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install app-local-store
pnpm add app-local-store
yarn add app-local-store
bun add app-local-store
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2022-06-16 |
| First published | 2021-05-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Gal Elmalah |
| Maintainers | galelmalah |
| Keywords | storage, db, persist, data, store, config |

## Links

- npm: https://www.npmjs.com/package/app-local-store
- Repository: https://github.com/galElmalah/app-local-store
- Homepage: https://github.com/galElmalah/app-local-store#readme
- Issues: https://github.com/galElmalah/app-local-store/issues
- npm.io page: https://npm.io/package/app-local-store

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 1.0.6 (latest) — 2022-06-16
- 1.0.5 — 2021-05-23
- 1.0.4 — 2021-05-23
- 1.0.3 — 2021-05-22
- 1.0.2 — 2021-05-22
- 1.0.1 — 2021-05-22
- 1.0.0 — 2021-05-22

## README

# app-local-store
Easily persist app data.

## What is it good for?
CLI apps! 
This package makes persisting data scoped to your app a breeze.
## Installation
```bash
npm i --save app-local-store
```

## Usage
```typescript
import { anAppDataStore } from 'app-local-store';

/* 
The store data will be initialized with this data only on the first time a store is created.
You can also not provide this value and set it yourself using the store "write" method.
*/
const dataShape = {
  preference: {
    user: {...},
    system: {...}
  },
  scopes: ...
  ...
};

const appName = 'app'
const store = await anAppDataStore(appName, {initialData:dataShape});
const newUserPreference = {...}
await store.set("preference", {...initialData.preference, user: newUserPreference})

// On some other run of your app when getting the user preference it will be equal to "newUserPreference"
const { user } = await store.get("preference");

// Dump the entire app data to an object
const myAppData = await store.read();
```

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