Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix typographical errors #432

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/.config/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ landing:
description: "Your code will work on any JavaScript runtime including Node.js, Bun, Deno and Workers."
icon: "i-material-symbols-lock-open-right-outline-rounded"
- title: "Built-in drivers"
description: "Unstorage is shipped with 20+ built-in drivers for different platforms: Memory (default), FS, Redis, Memory, MongoDB, CloudFlare, GitHub..."
description: "Unstorage is shipped with 20+ built-in drivers for different platforms: Memory (default), FS, Redis, Memory, MongoDB, CloudFlare, GitHub, etc."
icon: "i-material-symbols-usb"
- title: "Snapshots"
description: "Expand your server and add capabilities. Your codebase will scale with your project."
Expand All @@ -40,7 +40,7 @@ landing:
description: "Unix-style driver mounting to combine storages on different mounts."
icon: "i-material-symbols-view-list-outline"
- title: "JSON friendly"
description: "Unstorage automatically serialization and deserialization JSON values."
description: "Unstorage automatically serializes and deserializes JSON values."
icon: "i-material-symbols-magic-button"
- title: "Binary Support"
description: "Store binary and raw data like images, videos, audio files, etc."
Expand Down
18 changes: 9 additions & 9 deletions docs/1.guide/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ icon: ph:book-open-duotone

## Introduction

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.
We usually choose one or more storage backends based on our use cases, such as the filesystem, a database, or LocalStorage for browsers. It soon starts to create troubles when supporting and combining multiple options or switching between them. For JavaScript library authors, this usually means that they have to decide how many platforms they are going to support and implement storage for each of them.

## Installation

Expand Down Expand Up @@ -42,17 +42,17 @@ await storage.hasItem("foo:bar");

### `getItem(key, opts?)`

Gets the value of a key in storage. Resolves to either a javascript primitive value or `undefined`.
Gets the value of a key in storage. Resolves to either a JavaScript primitive value or `undefined`.

```js
await storage.getItem("foo:bar");
```

### `getItems(items, opts)`

(Experimental) Gets the value of a multiple keys in storage in parallel.
(Experimental) Gets the value of multiple keys in storage in parallel.

Each item in array can be either a string or an object with`{ key, options? }` format.
Each item in the array can either be a string or an object with `{ key, options? }` format.

Returned value is a Promise resolving to an array of objects with `{ key, value }` format.

Expand All @@ -73,7 +73,7 @@ Add/Update a value to the storage.

If the value is not a string, it will be stringified.

If value is `undefined`, it is same as calling `removeItem(key)`.
If the value is `undefined`, it is same as calling `removeItem(key)`.

```js
await storage.setItem("foo:bar", "baz");
Expand All @@ -93,7 +93,7 @@ Returned value is a Promise resolving to an array of objects with `{ key, value

Add/Update a value to the storage in raw format.

If value is `undefined`, it is same as calling `removeItem(key)`.
If value is `undefined`, it is the same as calling `removeItem(key)`.

```js
await storage.setItemRaw("data/test.bin", new Uint8Array([1, 2, 3]));
Expand Down Expand Up @@ -145,7 +145,7 @@ Get all keys. Returns an array of strings.

Meta keys (ending with `$`) will be filtered.

If a base is provided, only keys starting with the base will be returned also only mounts starting with base will be queried. Keys still have a full path.
If a base is provided, only keys starting with the base will be returned and only mounts starting with base will be queried. Keys still have a full path.

```js
await storage.getKeys();
Expand Down Expand Up @@ -203,7 +203,7 @@ await storage.unmount("/output");

### `watch(callback)`

Starts watching on all mountpoints. If driver does not supports watching, only emits even when `storage.*` methods are called.
Starts watching on all mountpoints. If driver does not support watching, only emits even when `storage.*` methods are called.

```js
const unwatch = await storage.watch((event, key) => {});
Expand Down Expand Up @@ -310,7 +310,7 @@ const postStorage = prefixStorage<Post>(storage, "assets:posts");
await postStorage.getItem("foo.json"); // => <Post>
```

In [strict mode](https://www.typescriptlang.org/tsconfig#strict), will also return the undefined type to help you handle the case when miss `getItem`.
In [strict mode](https://www.typescriptlang.org/tsconfig#strict), it will also return the `undefined` type to help you handle the case when `getItem` is missing.

```ts
"use strict";
Expand Down
6 changes: 3 additions & 3 deletions docs/1.guide/2.utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ icon: et:tools-2

# Utilities

> Unstorage exposes several utilities. You can individually import them and add only needed bytes to your bundle.
> Unstorage exposes several utilities. You can individually import them and add only the needed bytes to your bundle.

## Namespace

Create a namespaced instance of main storage. All operations are virtually prefixed. Useful to create shorcuts and limit access.
Create a namespaced instance of the main storage. All operations are virtually prefixed, which is useful for creating shorcuts and limiting access.

`prefixStorage(storage, prefix)`{lang=ts}

Expand All @@ -26,7 +26,7 @@ await assetsStorage.setItem("x", "hello!");

- `snapshot(storage, base?)`{lang=ts}

Take a snapshot from all keys in specified base into a plain javascript object (string: string). Base is removed from keys.
Takes a snapshot from all keys in the specified base and stores them in a plain JavaScript object (string: string). Base is removed from keys.

```js
import { snapshot } from "unstorage";
Expand Down
14 changes: 7 additions & 7 deletions docs/1.guide/3.http-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ icon: ic:baseline-http

# HTTP Server

> We can expose unstorage instance to an http server to allow remote connections.
> We can expose unstorage's instance to an HTTP server to allow remote connections.

Request url is mapped to key and method/body mapped to function. See below for supported http methods.
Request url is mapped to a key and method/body is mapped to a function. See below for supported HTTP methods.

## Storage Server

Expand All @@ -31,10 +31,10 @@ const storageServer = createStorageServer(storage, {
await listen(storageServer.handle);
```

The `storageServer` is an [h3](https://github.com/unjs/h3) instance. Checkout also [listhen](https://github.com/unjs/listhen) for an elegant HTTP listener.
The `storageServer` is an [h3](https://github.com/unjs/h3) instance. Check out also [listhen](https://github.com/unjs/listhen) for an elegant HTTP listener.

::warning
**πŸ›‘οΈ Security Note:** Make sure to always implement `authorize` in order to protect server when it is exposed to a production environment.
**πŸ›‘οΈ Security Note:** Make sure to always implement `authorize` in order to protect the server when it is exposed to a production environment.
::

## Storage Client
Expand All @@ -55,10 +55,10 @@ const keys = await client.getKeys();

## HTTP Methods

- `GET`: Maps to `storage.getItem` or `storage.getKeys` when path ending with `/` or `/:`
- `GET`: Maps to `storage.getItem` or `storage.getKeys` when the path ends with `/` or `/:`
- `HEAD`: Maps to `storage.hasItem`. Returns 404 if not found.
- `PUT`: Maps to `storage.setItem`. Value is read from body and returns `OK` if operation succeeded.
- `DELETE`: Maps to `storage.removeItem` or `storage.clear` when path ending with `/` or `/:`. Returns `OK` if operation succeeded.
- `PUT`: Maps to `storage.setItem`. Value is read from the body and returns `OK` if the operation succeeded.
- `DELETE`: Maps to `storage.removeItem` or `storage.clear` when the path ends with `/` or `/:`. Returns `OK` if the operation succeeded.

::note
When passing `accept: application/octet-stream` for GET and SET operations, the server switches to binary mode via `getItemRaw` and `setItemRaw`.
Expand Down
4 changes: 2 additions & 2 deletions docs/1.guide/4.custom-driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: carbon:area-custom

> It is possible to extend `unstorage` by creating a custom driver.

Explore [src/drivers](https://github.com/unjs/unstorage/tree/main/src/drivers) to inspire how to implement them. Methods can
Explore [src/drivers](https://github.com/unjs/unstorage/tree/main/src/drivers) to get an idea of how to implement them. Methods can:

```js
import { createStorage, defineDriver } from "unstorage";
Expand Down Expand Up @@ -38,4 +38,4 @@ Some important notes:
- Returning a promise is optional, you can return a direct value (see [memory driver](https://github.com/unjs/unstorage/blob/main/src/drivers/memory.ts))
- You don't have acces to the mount base
- Value returned by `getItem` can be a serializable `object` or `string`
- When setting `watch` method, unstorage default handler will be disabled. You are responsible to emit event on `getItem`, `setItem` and `removeItem`.
- When setting `watch` method, the unstorage default handler will be disabled. You are responsible for emitting an event on `getItem`, `setItem` and `removeItem`.
2 changes: 1 addition & 1 deletion docs/2.drivers/0.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: icon-park-outline:hard-disk

> Unstorage has several built-in drivers

See next sections for guide about using each driver.
See the next sections for guide about using each driver.

::read-more{to="/guide#mountmountpoint-driver"}
See [`driver.mount()`] to learn about how to
Expand Down
8 changes: 4 additions & 4 deletions docs/2.drivers/azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ icon: mdi:microsoft-azure

## Azure App Configuration

Store data in the key value store of Azure App Configuration.
Store data in the key-value store of Azure App Configuration.

### Usage

::note{to="https://learn.microsoft.com/en-us/azure/azure-app-configuration/overview"}
Learn more about Azure App Configuration.
::

This driver uses the configuration store as a key value store. It uses the `key` as the name and the `value` as content. You can also use labels to differentiate between different environments (dev, prod, etc.) and use prefixes to differentiate between different applications (app01, app02, etc.).
This driver uses the configuration store as a key-value store. It uses the `key` as the name and the `value` as content. You can also use labels to differentiate between different environments (dev, prod, etc.) and use prefixes to differentiate between different applications (app01, app02, etc.).

To use it, you will need to install `@azure/app-configuration` and `@azure/identity` in your project:

Expand All @@ -40,7 +40,7 @@ const storage = createStorage({
The driver supports the following authentication methods:

- **`DefaultAzureCredential`**: This is the recommended way to authenticate. It will use managed identity or environment variables to authenticate the request. It will also work in a local environment by trying to use Azure CLI or Azure PowerShell to authenticate. <br>
⚠️ Make sure that your Managed Identity or personal account has the `App Configuration Data Owner` role assigned to it, even if you already are `Contributor` or `Owner` on the app configuration resource.
⚠️ Make sure that your Managed Identity or personal account has the `App Configuration Data Owner` role assigned to it, even if you already are the `Contributor` or `Owner` on the app configuration resource.
- **`connectionString`**: The app configuration connection string. Not recommended for use in production.

**Options:**
Expand Down Expand Up @@ -84,7 +84,7 @@ const storage = createStorage({
**Authentication:**

- **`DefaultAzureCredential`**: This is the recommended way to authenticate. It will use managed identity or environment variables to authenticate the request. It will also work in a local environment by trying to use Azure CLI or Azure PowerShell to authenticate. <br>
⚠️ Make sure that your Managed Identity or personal account has at least `Cosmos DB Built-in Data Contributor` role assigned to it. If you already are `Contributor` or `Owner` on the resource it should also be enough, but does not accomplish a model of least privilege.
⚠️ Make sure that your Managed Identity or personal account has at least `Cosmos DB Built-in Data Contributor` role assigned to it. If you already are the `Contributor` or `Owner` on the resource it should also be enough, but that does not accomplish a model of least privilege.
- **`accountKey`**: CosmosDB account key. If not provided, the driver will use the DefaultAzureCredential (recommended).

**Options:**
Expand Down
4 changes: 2 additions & 2 deletions docs/2.drivers/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ icon: ph:browser-thin

# Browser

> Browser based storages
> Browser based storages.

## Local Storage

Expand Down Expand Up @@ -86,5 +86,5 @@ const storage = createStorage({
- `storeName`: Custom name for store. Defaults to `keyval`

::note
IndexedDB is a browser database. avoid using this preset on server environments.
IndexedDB is a browser database. Avoid using this preset on server environments.
::
2 changes: 1 addition & 1 deletion docs/2.drivers/capacitor-preferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ icon: nonicons:capacitor-16

# Capacitor Preferences

> Stores data via Capacitor Preferences API on mobile devices or the local storage on the web.
> Store data via Capacitor Preferences API on mobile devices or local storage on the web.

::read-more{to="https://capacitorjs.com/docs/apis/preferences"}
Learn more about Capacitor Preferences API.
Expand Down
2 changes: 1 addition & 1 deletion docs/2.drivers/cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Learn more about Cloudflare KV API.

You need to create a KV namespace. See [KV Bindings](https://developers.cloudflare.com/workers/runtime-apis/kv#kv-bindings) for more information.

**Note:** This driver uses native fetch and works universally! For using directly in a cloudflare worker environment, please use `cloudflare-kv-binding` driver for best performance!
**Note:** This driver uses native fetch and works universally! For a direct usage in a cloudflare worker environment, please use `cloudflare-kv-binding` driver for best performance!

```js
import { createStorage } from "unstorage";
Expand Down
2 changes: 1 addition & 1 deletion docs/2.drivers/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ icon: mdi:github

## Usage

This driver fetches all possible keys once and keep it in cache for 10 minutes. Due to GitHub rate limit, it is highly recommanded to provide a token. It only applies to fetching keys.
This driver fetches all possible keys once and keep it in cache for 10 minutes. Due to GitHub rate limit, it is highly recommended to provide a token. It only applies to fetching keys.

```js
import { createStorage } from "unstorage";
Expand Down
2 changes: 1 addition & 1 deletion docs/2.drivers/lru-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Keeps cached data in memory using [LRU Cache](https://www.npmjs.com/package/lru-

See [`lru-cache`](https://www.npmjs.com/package/lru-cache) for supported options.

By default [`max`](https://www.npmjs.com/package/lru-cache#max) setting is set to `1000` items.
By default, [`max`](https://www.npmjs.com/package/lru-cache#max) setting is set to `1000` items.

A default behavior for [`sizeCalculation`](https://www.npmjs.com/package/lru-cache#sizecalculation) option is implemented based on buffer size of both key and value.

Expand Down
2 changes: 1 addition & 1 deletion docs/2.drivers/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ icon: bi:memory
Keeps data in memory using [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map). (default storage)

::note
By default it is mounted to top level so it is unlikely you need to mount it again.
By default, it is mounted at the top level, so it's unlikely that you will need to mount it again.
::

```js
Expand Down
2 changes: 1 addition & 1 deletion docs/2.drivers/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ icon: teenyicons:mongodb-outline

# MongoDB

> Store data in MongoDB using Node.js mongodb package.
> Store data in MongoDB using Node.js MongoDB package.

## Usage

Expand Down
4 changes: 2 additions & 2 deletions docs/2.drivers/netlify.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: teenyicons:netlify-solid

> Store data in Netlify Blobs.

Store data in a [Netlify Blobs](https://docs.netlify.com/blobs/overview/) store This is supported in both [edge](#using-in-netlify-edge) and Node.js function runtimes, as well at during builds.
Store data in a [Netlify Blobs](https://docs.netlify.com/blobs/overview/) store. This is supported in both [edge](#using-in-netlify-edge) and Node.js function runtimes, as well as during builds.

::read-more{title="Netlify Blobs" to="https://docs.netlify.com/blobs/overview/"}
::
Expand All @@ -24,7 +24,7 @@ const storage = createStorage({
});
```

You can create a deploy-scoped store by settings `deployScoped` option to `true`. This will mean that the deploy only has access to its own store. The store is managed alongside the deploy, with the same deploy previews, deletes, and rollbacks. This is required during builds, which only have access to deploy-scoped stores.
You can create a deploy-scoped store by setting `deployScoped` option to `true`. This will mean that the deploy only has access to its own store. The store is managed alongside the deploy, with the same deploy previews, deletes, and rollbacks. This is required during builds, which only have access to deploy-scoped stores.

```js
import { createStorage } from "unstorage";
Expand Down
2 changes: 1 addition & 1 deletion docs/2.drivers/planetscale.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ const storage = createStorage({

- **`url`** (required): You can find your URL in the [Planetscale dashboard](https://planetscale.com/docs/tutorials/connect-nodejs-app).
- `table`: The name of the table to read from. It defaults to `storage`.
- `boostCache`: Whether to enable cached queries: see [docs](https://planetscale.com/docs/concepts/query-caching-with-planetscale-boost#using-cached-queries-in-your-application).
- `boostCache`: Whether to enable cached queries: See [docs](https://planetscale.com/docs/concepts/query-caching-with-planetscale-boost#using-cached-queries-in-your-application).
Loading