@gravito/nebula 1.0.0-alpha.2 → 1.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.zh-TW.md +37 -0
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +3 -3
package/README.zh-TW.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @gravito/nebula
|
|
2
|
+
|
|
3
|
+
> Gravito 的標準儲存 Orbit,提供檔案儲存抽象層。
|
|
4
|
+
|
|
5
|
+
## 安裝
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @gravito/nebula
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 快速開始
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { PlanetCore } from 'gravito-core'
|
|
15
|
+
import orbitStorage from '@gravito/nebula'
|
|
16
|
+
|
|
17
|
+
const core = new PlanetCore()
|
|
18
|
+
|
|
19
|
+
const storage = orbitStorage(core, {
|
|
20
|
+
local: {
|
|
21
|
+
root: './uploads',
|
|
22
|
+
baseUrl: '/uploads'
|
|
23
|
+
},
|
|
24
|
+
exposeAs: 'storage'
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
core.app.post('/upload', async (c) => {
|
|
28
|
+
const body = await c.req.parseBody()
|
|
29
|
+
const file = body['file']
|
|
30
|
+
|
|
31
|
+
if (file instanceof File) {
|
|
32
|
+
await storage.put(file.name, file)
|
|
33
|
+
return c.json({ url: storage.getUrl(file.name) })
|
|
34
|
+
}
|
|
35
|
+
return c.text('No file uploaded', 400)
|
|
36
|
+
})
|
|
37
|
+
```
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravito/nebula",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"author": "Carl Lee <carllee0520@gmail.com>",
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"gravito-core": "1.0.0-beta.
|
|
38
|
+
"gravito-core": "1.0.0-beta.5"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"gravito-core": "1.0.0-beta.
|
|
41
|
+
"gravito-core": "1.0.0-beta.5",
|
|
42
42
|
"hono": "^4.11.1",
|
|
43
43
|
"bun-types": "latest",
|
|
44
44
|
"typescript": "^5.9.3"
|