# @varasto/memory-storage

> Varasto storage implementation that stores data in memory

Latest version **4.0.0** (published 2026-09-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @varasto/memory-storage
pnpm add @varasto/memory-storage
yarn add @varasto/memory-storage
bun add @varasto/memory-storage
```

## Health

**Score 65/100 (B)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-09-05 |
| First published | 2021-08-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.0 |
| Dependencies | 1 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Rauli Laine |
| Maintainers | rauli |
| Keywords | varasto |

## Links

- npm: https://www.npmjs.com/package/@varasto/memory-storage
- Repository: https://github.com/RauliL/varasto
- Homepage: https://rauli.dev/varasto
- Issues: https://github.com/RauliL/varasto/issues
- npm.io page: https://npm.io/package/@varasto/memory-storage

## Dependencies (1)

- [@varasto/storage](https://npm.io/package/@varasto/storage.md) ^6.0.0

## Recent versions

- 4.0.0 (latest) — 2026-09-05
- 3.0.0 — 2023-10-05
- 2.0.0 — 2023-09-30
- 1.1.0 — 2021-10-05
- 1.0.1 — 2021-08-13
- 1.0.0 — 2021-08-13

## README

# @varasto/memory-storage

[![npm][npm-image]][npm-url]

Implementation of an [storage] which stores values in memory instead of hard
disk or remote server.

[npm-image]: https://img.shields.io/npm/v/@varasto/memory-storage.svg
[npm-url]: https://npmjs.org/package/@varasto/memory-storage
[storage]: https://www.npmjs.com/package/@varasto/storage

Because it provides full storage implementation without persistence, it's
useful for writing test cases for libraries/applications that use Varasto
storages for storing data.

## Installation

```sh
$ npm install --save @varasto/memory-storage
```

## Usage

The package provides a class called `MemoryStorage` which is an implementation
of [Storage] type.

Basic usage of the API looks like this:

```TypeScript
import { MemoryStorage } from '@varasto/memory-storage';

const storage = new MemoryStorage();
```

Memory storage instance also has an additional `clear()` method that will
remove either all data from the storage, or items from specified namespace.

```TypeScript
storage.clear(); // Removes all data from the storage.

storage.clear('foo'); // Removes all items from namespace "foo".
```

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