# akv

> A simple key value store using single json file

Latest version **2.0.1** (published 2019-02-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install akv
pnpm add akv
yarn add akv
bun add akv
```

## 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 | 2.0.1 |
| Published | 2019-02-16 |
| First published | 2016-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 2 |
| Unpacked size | 22.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Taka Okunishi |
| Maintainers | okunishinishi |
| Keywords | store |

## Links

- npm: https://www.npmjs.com/package/akv
- Repository: https://github.com/a-labo/akv
- Homepage: https://github.com/a-labo/akv#readme
- Issues: https://github.com/a-labo/akv/issues
- npm.io page: https://npm.io/package/akv

## Dependencies (2)

- [crc](https://npm.io/package/crc.md) ^3.8.0
- [asfs](https://npm.io/package/asfs.md) ^2.2.0

## Recent versions

- 2.0.1 (latest) — 2019-02-16
- 2.0.0 — 2017-09-17
- 1.1.1 — 2016-09-19
- 1.1.0 — 2016-09-11
- 1.0.21 — 2016-08-13
- 1.0.20 — 2016-08-06
- 1.0.19 — 2016-08-05
- 1.0.18 — 2016-08-05
- 1.0.17 — 2016-08-01
- 1.0.16 — 2016-07-18
- 1.0.15 — 2016-07-18
- 1.0.14 — 2016-07-18
- 1.0.13 — 2016-07-18
- 1.0.12 — 2016-07-17
- 1.0.11 — 2016-07-17
- … 10 more at https://npm.io/package/akv/versions

## README

akv
==========

<!---
This file is generated by ape-tmpl. Do not update manually.
--->

<!-- Badge Start -->
<a name="badges"></a>

[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url]

[bd_repo_url]: https://github.com/a-labo/akv
[bd_travis_url]: http://travis-ci.org/a-labo/akv
[bd_travis_shield_url]: http://img.shields.io/travis/a-labo/akv.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/a-labo/akv
[bd_travis_com_shield_url]: https://api.travis-ci.com/a-labo/akv.svg?token=
[bd_license_url]: https://github.com/a-labo/akv/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/a-labo/akv
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/a-labo/akv.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/a-labo/akv.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/a-labo/akv
[bd_gemnasium_shield_url]: https://gemnasium.com/a-labo/akv.svg
[bd_npm_url]: http://www.npmjs.org/package/akv
[bd_npm_shield_url]: http://img.shields.io/npm/v/akv.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg

<!-- Badge End -->


<!-- Description Start -->
<a name="description"></a>

A simple key value store using single json file

<!-- Description End -->


<!-- Overview Start -->
<a name="overview"></a>



<!-- Overview End -->


<!-- Sections Start -->
<a name="sections"></a>

<!-- Section from "doc/guides/01.Installation.md.hbs" Start -->

<a name="section-doc-guides-01-installation-md"></a>

Installation
-----

```bash
$ npm install akv --save
```


<!-- Section from "doc/guides/01.Installation.md.hbs" End -->

<!-- Section from "doc/guides/02.Usage.md.hbs" Start -->

<a name="section-doc-guides-02-usage-md"></a>

Usage
---------

```javascript
'use strict'

const akv = require('akv')
const co = require('co')

co(function * () {
  let storage = akv('tmp/my-storage.json')
  // Set key value
  yield storage.set('foo', 'bar')

  // Get key value
  let foo = yield storage.get('foo')
  console.log(foo) // => bar
  // Delete by key
  yield storage.del('foo')
}).catch((err) => console.error(err))

```


<!-- Section from "doc/guides/02.Usage.md.hbs" End -->

<!-- Section from "doc/guides/03.Methods.md.hbs" Start -->

<a name="section-doc-guides-03-methods-md"></a>

Methods
---------

Available methods

| Signature | Description |
| ---- | ----------- |
| `.touch() -> Promise` | Touch file |
| `.set(key, value) -> Promise` | Set a value |
| `.keys() -> Promise` | Get all keys |
| `.get(key) -> Promise` | Get a value |
| `.all() -> Promise` | Get all values |
| `.del(key) -> Promise` | Delete a value |
| `.destroy() -> Promise` | Delete all values |


<!-- Section from "doc/guides/03.Methods.md.hbs" End -->

<!-- Section from "doc/guides/04.Tips.md.hbs" Start -->

<a name="section-doc-guides-04-tips-md"></a>

Tips
-----


## Commit to files

Normally, akv flushes data into files with some interval.
But somethings you need to explicitly call commit changes.

```
let storage = akv('tmp/my-storage.json')
/* ... */
storage.commit() // Force to flush files
```

<!-- Section from "doc/guides/04.Tips.md.hbs" End -->


<!-- Sections Start -->


<!-- LICENSE Start -->
<a name="license"></a>

License
-------
This software is released under the [MIT License](https://github.com/a-labo/akv/blob/master/LICENSE).

<!-- LICENSE End -->


<!-- Links Start -->
<a name="links"></a>

Links
------

+ [a-labo][a_labo_url]

[a_labo_url]: https://github.com/a-labo

<!-- Links End -->

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