# @leofcoin/storage

> [![CodeQL](https://github.com/leofcoin/storage/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/leofcoin/storage/actions/workflows/codeql-analysis.yml)

Latest version **3.5.38** (published 2025-07-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @leofcoin/storage
pnpm add @leofcoin/storage
yarn add @leofcoin/storage
bun add @leofcoin/storage
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.5.38 |
| Published | 2025-07-06 |
| First published | 2020-05-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 1 |
| Unpacked size | 23.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | vandeurenglenn |

## Links

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

## Dependencies (1)

- [classic-level](https://npm.io/package/classic-level.md) ^3.0.0

## Recent versions

- 3.5.38 (latest) — 2025-07-06
- 3.5.37 — 2025-07-06
- 3.5.36 — 2025-07-04
- 3.5.35 — 2025-07-04
- 3.5.34 — 2025-05-11
- 3.5.33 — 2025-05-11
- 3.5.32 — 2024-09-08
- 3.5.31 — 2024-08-31
- 3.5.30 — 2024-08-21
- 3.5.29 — 2024-08-21
- 3.5.28 — 2024-04-19
- 3.5.27 — 2024-04-12
- 3.5.26 — 2024-04-05
- 3.5.25 — 2024-04-05
- 3.5.24 — 2024-02-12
- … 54 more at https://npm.io/package/@leofcoin/storage/versions

## README

# LeofcoinStorage 
[![CodeQL](https://github.com/leofcoin/storage/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/leofcoin/storage/actions/workflows/codeql-analysis.yml)

>


## install
```sh
npm i @leofcoin/storage
```

## breaking changes
[checkout](./BREAKINGCHANGES.md)

## Usage

```js
import LeofcoinStorage from '@leofcoin/storage'

const storage = new LeofcoinStorage(name, root)
await storage.init()
// stores/returns a value as uint8Array

await storage.put('hello', 'world')
(await storage.get('hello')).toString() // world
await storage.get() // [{ key: 'hello', value: 'world'}]
await storage.has('hello') // true
await storage.size() // 4
await storage.delete('hello') // bye world
```

## API

### options

name: store name<br>
root: root directory<br>

```js
new LeofcoinStorage(name, root)
```

### methods

#### get
key: path/filename<br>
returns: Promise()&lt;uint8Array&gt;

```js
storage.get(key)

const all = storage.get()
console.log(all) // [{key,value}]
```

#### put
key: path/filename<br>
value: path/filename<br>
returns: Promise()

```js
storage.put(key, value)
```

#### has
key: path/filename<br>
returns: Promise()&lt;Boolean&gt;

```js
storage.has(key)
```

#### keys
returns: Promise()&lt;Array&gt;

```js
storage.keys()
```

#### values
returns: Promise()&lt;Array&gt;

```js
storage.values(limit)
```

## build for browser
rollup
```js
import resolve from '@rollup/plugin-node-resolve'
export default [{
  input: './node_modules/@leofcoin/src/storage.js',
  output: {
    file: 'dist/storage.js',
    format: 'es'
  }
}, {
  input: './node_modules/@leofcoin/src/browser-store.js',
  output: {
    file: 'dist/browser-store.js',
    format: 'es'
  },
  plugins: [
    resolve()
  ]
}]
```

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