@nestjs-dash/storage 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +62 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # @nestjs-dash/storage
2
+
3
+ The file storage plugin for nestjs-dash — local-disk and S3-compatible disks, signed URLs, and the `StorageService` used by every upload field (`ImageUpload`/`FileUpload`) and the built-in upload endpoint.
4
+
5
+ ## This is a required companion, not optional
6
+
7
+ Despite being a separate package, this is **required** alongside `@nestjs-dash/nestjs` for any real app: the built-in `/admin/upload` endpoint always depends on it. Install it whenever you install `@nestjs-dash/nestjs`.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add @nestjs-dash/storage
13
+ ```
14
+
15
+ `@aws-sdk/client-s3`/`@aws-sdk/s3-request-presigner` are optional peers, needed only if you configure an S3-compatible disk.
16
+
17
+ ## Usage
18
+
19
+ ```ts
20
+ import { AdminModule } from '@nestjs-dash/nestjs';
21
+
22
+ AdminModule.forRootAsync({
23
+ useFactory: () => ({
24
+ panel: {
25
+ // ...
26
+ storage: {
27
+ disks: {
28
+ local: { driver: 'local', root: './uploads', publicUrl: '/uploads' },
29
+ s3: {
30
+ driver: 's3',
31
+ bucket: process.env.S3_BUCKET!,
32
+ endpoint: process.env.S3_ENDPOINT,
33
+ region: process.env.S3_REGION,
34
+ },
35
+ },
36
+ defaultDisk: 'local',
37
+ },
38
+ },
39
+ }),
40
+ });
41
+ ```
42
+
43
+ Fields declare which disk they use:
44
+
45
+ ```ts
46
+ ImageUpload.make('avatar').disk('s3').directory('avatars');
47
+ ```
48
+
49
+ ## What's included
50
+
51
+ - **`LocalDisk`** — filesystem storage, with `signLocalUrl`/`verifyLocalUrlSignature` for signed, time-limited download URLs.
52
+ - **`S3Disk`** — any S3-compatible object store (AWS S3, MinIO, RustFS, …).
53
+ - **`StorageService`** — the runtime service fields and the upload controller use to read/write/delete files regardless of disk.
54
+ - **`buildStorageKey`/`createDisk`** — lower-level helpers for constructing storage keys and disk instances directly.
55
+
56
+ ## Part of nestjs-dash
57
+
58
+ This package is one piece of [nestjs-dash](https://github.com/nestjs-dash/nestjs-dash), a NestJS-native admin framework. [`@nestjs-dash/media`](https://github.com/nestjs-dash/nestjs-dash) builds a polymorphic media library on top of this package's disks.
59
+
60
+ ## License
61
+
62
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs-dash/storage",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "File storage plugin for NestJS Dash (local disk + S3-compatible disks, signed URLs)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -17,7 +17,7 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@nestjs-dash/nestjs": "1.0.0"
20
+ "@nestjs-dash/nestjs": "1.0.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@nestjs-dash/typescript-config": "0.1.0",