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

feat: add uploadthing driver #390

Merged
merged 17 commits into from
Dec 18, 2024
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ VITE_VERCEL_BLOB_READ_WRITE_TOKEN=
VITE_CLOUDFLARE_ACC_ID=
VITE_CLOUDFLARE_KV_NS_ID=
VITE_CLOUDFLARE_TOKEN=

VITE_UPLOADTHING_TOKEN=
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
VITE_CLOUDFLARE_ACC_ID: ${{ secrets.VITE_CLOUDFLARE_ACC_ID }}
VITE_CLOUDFLARE_KV_NS_ID: ${{ secrets.VITE_CLOUDFLARE_KV_NS_ID }}
VITE_CLOUDFLARE_TOKEN: ${{ secrets.VITE_CLOUDFLARE_TOKEN }}
VITE_UPLOADTHING_TOKEN: ${{ secrets.VITE_UPLOADTHING_TOKEN }}
- uses: codecov/codecov-action@v5
- name: nightly release
if: |
Expand Down
32 changes: 32 additions & 0 deletions docs/2.drivers/uploadthing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# UploadThing

Store data using UploadThing.

::note{to="https://uploadthing.com/"}
Learn more about UploadThing.
::

```js
import { createStorage } from "unstorage";
import uploadthingDriver from "unstorage/drivers/uploadthing";

const storage = createStorage({
driver: uploadthingDriver({
// apiKey: "<your api key>",
pi0 marked this conversation as resolved.
Show resolved Hide resolved
}),
});
```

To use, you will need to install `uploadthing` dependency in your project:

```json
{
"dependencies": {
"uploadthing": "latest"
}
}
```

**Options:**

- `apiKey`: Your UploadThing API key. Will be automatically inferred from the `UPLOADTHING_SECRET` environment variable if not provided.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"types-cloudflare-worker": "^1.2.0",
"typescript": "^5.7.2",
"unbuild": "^3.0.1",
"uploadthing": "^7.4.1",
"vite": "^6.0.3",
"vitest": "^2.1.8",
"wrangler": "^3.95.0"
Expand All @@ -108,6 +109,7 @@
"@azure/keyvault-secrets": "^4.9.0",
"@azure/storage-blob": "^12.26.0",
"@capacitor/preferences": "^6.0.3",
"@deno/kv": ">=0.8.4",
"@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0",
"@planetscale/database": "^1.19.0",
"@upstash/redis": "^1.34.3",
Expand All @@ -116,7 +118,7 @@
"db0": ">=0.2.1",
"idb-keyval": "^6.2.1",
"ioredis": "^5.4.1",
"@deno/kv": ">=0.8.4"
"uploadthing": "^7.4.1"
},
"peerDependenciesMeta": {
"@azure/app-configuration": {
Expand All @@ -140,6 +142,9 @@
"@capacitor/preferences": {
"optional": true
},
"@deno/kv": {
"optional": true
},
"@netlify/blobs": {
"optional": true
},
Expand All @@ -164,7 +169,7 @@
"ioredis": {
"optional": true
},
"@deno/kv": {
"uploadthing": {
"optional": true
}
},
Expand Down
101 changes: 100 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading