# @rpldy/safe-storage

> safe (dont throw) versions of local and session storage

Latest version **1.13.0** (published 2025-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rpldy/safe-storage
pnpm add @rpldy/safe-storage
yarn add @rpldy/safe-storage
bun add @rpldy/safe-storage
```

## Health

**Score 60/100 (C)** — status: stable.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.13.0 |
| Published | 2025-11-26 |
| First published | 2020-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1252 |
| Author | yoav niran (https://github.com/yoavniran) |
| Maintainers | yoavniran |

## Links

- npm: https://www.npmjs.com/package/@rpldy/safe-storage
- Repository: https://github.com/rpldy/react-uploady
- Homepage: https://react-uploady.org
- Funding: https://opencollective.com/react-uploady
- npm.io page: https://npm.io/package/@rpldy/safe-storage

## Dependencies (1)

- [@rpldy/shared](https://npm.io/package/@rpldy/shared.md) 1.13.0

## Recent versions

- 1.13.0 (latest) — 2025-11-26
- 1.12.0-rc.0 (next) — 2025-10-28
- 1.4.2-alpha.0 (alpha) — 2023-03-27
- 1.12.0 — 2025-10-30
- 1.11.0 — 2025-07-18
- 1.10.0 — 2025-04-18
- 1.9.1 — 2025-02-07
- 1.9.0 — 2024-12-13
- 1.9.0-rc.2 — 2024-12-08
- 1.9.0-rc.1 — 2024-11-10
- 1.9.0-rc.0 — 2024-11-04
- 1.8.3 — 2024-08-19
- 1.8.2 — 2024-07-30
- 1.8.1 — 2024-05-16
- 1.8.0 — 2024-02-22
- … 82 more at https://npm.io/package/@rpldy/safe-storage/versions

## README

<a href="https://opencollective.com/react-uploady">
    <img src="https://img.shields.io/opencollective/all/react-uploady?style=flat&logo=opencollective&label=Support%20us!&color=blue" alt="Support on Open Collective"/>
</a>
<a href="https://badge.fury.io/js/%40rpldy%2Fssafe-storage">
    <img src="https://badge.fury.io/js/%40rpldy%2Fsafe-storage.svg" alt="npm version" height="20"></a>
<a href="https://github.com/rpldy/react-uploady/actions/workflows/pr.yml">
        <img src="https://github.com/rpldy/react-uploady/actions/workflows/pr.yml/badge.svg" alt="Build Status"/></a>
<a href="https://codecov.io/gh/rpldy/react-uploady">
    <img src="https://codecov.io/gh/rpldy/react-uploady/branch/master/graph/badge.svg" alt="codecov status"/></a> 
<a href="https://bundlephobia.com/result?p=@rpldy/safe-storage">
    <img src="https://badgen.net/bundlephobia/minzip/@rpldy/safe-storage" alt="bundlephobia badge"/></a>
<a href="https://react-uploady-storybook.netlify.app/">
   <img src="https://cdn.jsdelivr.net/gh/storybookjs/brand@master/badge/badge-storybook.svg" alt="rpldy storybook"/></a>
   
   
# Safe Storage

> Internal package 

provides safe versions of localStorage and sessionStorage that don't throw because
of browser issues like safari in private mode.

exposes the same storage API as the browser's API - 

- https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
- https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage

In case storage isn't supported, the same API is available but will be replaced with no-op versions.

**The best place to get started is at our: [React-Uploady Documentation Website](https://react-uploady.org)**

## Installation

```shell
#Yarn: 
   $ yarn add @rpldy/safe-storage

#NPM:
   $ npm i @rpldy/safe-storage
``` 

## Important!

**All exports of this package are considered internal API and may change/disappear in any version: patch/minor/major**


## Example

```javascript
import { safeLocalStorage } from "@rpldy/safe-storage";

safeLocalStorage.setItem("test", "value");

const stored = safeLocalStorage.getItem("test");

safeLocalStorage.removeItem("test");
```

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