Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 28, 2023
1 parent 80a18f4 commit c078363
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 91 deletions.
89 changes: 17 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,23 @@
[![Codecov][codecov-src]][codecov-href]
[![bundle][bundle-src]][bundle-href]

💾 Universal Storage Layer
💾 Unstorage provides an async Key-Value storage API with conventional features like multi driver mounting, watching and working with metadata, dozens of built-in drivers and a [tiny core](https://bundlephobia.com/package/unstorage).

Read the [documentation](https://unstorage.unjs.io).
👉 [documentation](https://unstorage.unjs.io)

**Why ❓**
## Features

We choose one or more data storage based on our use-cases: a filesystem, a database or LocalStorage for browsers.

It soon starts to be create troubles for supporting and combining more than one or switching between them. For JavaScript library authors, this usually means they have to decide how many platforms they support and implement storage for each.

Comparing to similar solutions like [localforage](https://localforage.github.io/localForage/), unstorage core is almost 6x smaller (`28.9kB` vs `4.7kB`). It uses modern ESM/Typescript/Async syntax and more features to be used universally.

<br>
✅ Designed to work in all environments (Browser, NodeJS, and Workers) <br>
✅ Multiple built-in drivers (Memory, FS, LocalStorage, HTTP, Redis) <br>
✅ Asynchronous API <br>
✅ Unix-style driver mounting to combine storages<br>
✅ Default in-memory storage <br>
✅ Tree-shakable utils and tiny core <br>
✅ Driver native and user provided metadata <br>
✅ Native aware value serialization and deserialization <br>
✅ Restore initial state (hydration) <br>
✅ State snapshot <br>
✅ Driver agnostic watcher <br>
✅ HTTP Storage server (cli and programmatic) <br>
✅ Namespaced storage <br>
✅ Overlay storage (copy-on-write) <br>
✅ Binary and raw operations support (experimental) <br>
<br>
- Designed for all environments: Browser, NodeJS, and Workers
- Lots of Built-in drivers
- Asynchronous API
- Unix-style driver mounting to combine storages
- Default [in-memory](/drivers/memory) storage
- Tree-shakable utils and tiny core
- Auto JSON value serialization and deserialization
- Banary and raw value support
- State [snapshots](/utils#snapshots) and hydration
- Storage watcher
- HTTP Storage with [built-in server](/server)

## Usage

Expand All @@ -43,11 +31,12 @@ Install `unstorage` npm package:
```sh
# yarn
yarn add unstorage

# npm
npm install unstorage

# pnpm
pnpm add unstorage

```

```js
Expand All @@ -58,51 +47,7 @@ const storage = createStorage(/* opts */);
await storage.getItem("foo:bar"); // or storage.getItem('/foo/bar')
```

**Options:**

- `driver`: Default driver (using memory if not provided)

## Storage Interface

Check out [storage interface](https://unstorage.unjs.io/usage) for storage interface usage.

## Storage Utilities

Check out [storage utils](https://unstorage.unjs.io/utils) for available extra storage utilities.

## Storage Drivers

Unstorage has several built-in storage drivers you can instantiate and mount.

Local:

- [Filesystem](https://unstorage.unjs.io/driver/fs)
- [Memory](https://unstorage.unjs.io/driver/memory)
- [LRU Cache](https://unstorage.unjs.io/driver/lru-cache)
- [Localstorage](https://unstorage.unjs.io/driver/localstorage)

Special:

- [HTTP](https://unstorage.unjs.io/driver/http)
- [Overlay](https://unstorage.unjs.io/driver/overlay)
- [Custom Driver](https://unstorage.unjs.io/custom-driver)

Database:

- [MongoDB](https://unstorage.unjs.io/driver/mongodb)
- [Redis](https://unstorage.unjs.io/driver/redis)

Providers:

- [Azure App Configuration](https://unstorage.unjs.io/drivers/azure-app-configuration)
- [Azure Key Vault](https://unstorage.unjs.io/drivers/azure-key-vault)
- [Azure Cosmos](https://unstorage.unjs.io/drivers/azure-cosmos)
- [Azure Storage Block](https://unstorage.unjs.io/drivers/azure-storage-blod)
- [Azure Storage Table](https://unstorage.unjs.io/drivers//azure-storage-table)
- [Cloudflare KV Binding](https://unstorage.unjs.io/drivers/cloudflare-kv-binding)
- [Cloudflare KV HTTP](https://unstorage.unjs.io/drivers/cloudflare-kv-http)
- [Github](https://unstorage.unjs.io/drivers/github)
- [Planetscale](https://unstorage.unjs.io/drivers/planetscale)
👉 Check out the [the documentation](https://unstorage.unjs.io) for usage information.

## Contribution

Expand Down
3 changes: 1 addition & 2 deletions docs/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
export default defineAppConfig({
docus: {
title: "unjs/unstorage",
title: "💾 Unstorage",
description: "Universal Storage Layer.",
// image: '',
header: {
logo: false,
},
Expand Down
14 changes: 8 additions & 6 deletions docs/content/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
navigation.title: Introduction
---

# Unstorage
# Introduction

A unified and powerful async Key-Value storage with conventional features like multi driver mounting, watching and working with metadata, dozens of built-in drivers and a [tiny core](https://bundlephobia.com/package/unstorage).
Unstorage provides an async Key-Value storage API with conventional features like multi driver mounting, watching and working with metadata, dozens of built-in drivers and a [tiny core](https://bundlephobia.com/package/unstorage).

## Why?

We usually choose one or more storage backends based on our use-cases such as filesystem, a database or LocalStorage for browsers. It soon starts to be create troubles for supporting and combining more than one or switching between them. For JavaScript library authors, this usually means they have to decide how many platforms they support and implement storage for each.

## Features

::list

- Designed for all environments: Browser, NodeJS, and Workers
- Lots of Built-in drivers
- Asynchronous API
Expand All @@ -19,7 +25,3 @@ A unified and powerful async Key-Value storage with conventional features like m
- State [snapshots](/utils#snapshots) and hydration
- Storage watcher
- HTTP Storage with [built-in server](/server)

## Why?

In web applications, we usually choose one or more storage backends based on our use-cases such as filesystem, a database or LocalStorage for browsers. It soon starts to be create troubles for supporting and combining more than one or switching between them. For JavaScript library authors, this usually means they have to decide how many platforms they support and implement storage for each.
4 changes: 2 additions & 2 deletions docs/content/3.utils.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Utils
# Extra Utilities

Discover the `unstorage` utilities.
Unstorage exposes several utilities. You can individually import them and add only needed bytes to your budnle.

## Namespace

Expand Down
6 changes: 1 addition & 5 deletions docs/content/6.drivers/http.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
navigation.title: HTTP
---

# HTTP Driver
# HTTP

Use a remote HTTP/HTTPS endpoint as data storage. Supports built-in [http server](/http-server) methods.

Expand Down
4 changes: 0 additions & 4 deletions docs/content/6.drivers/overlay.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
navigation.title: Overlay (special)
---

# Overlay

This is a special driver that creates a multi-layer overlay driver.
Expand Down

0 comments on commit c078363

Please sign in to comment.