@zucker-framework/storage 1.0.0
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/LICENSE +201 -0
- package/NOTICE +22 -0
- package/THIRD_PARTY_NOTICES +4 -0
- package/dist/index.d.mts +433 -0
- package/dist/index.d.ts +433 -0
- package/dist/index.js +1081 -0
- package/dist/index.mjs +1035 -0
- package/package.json +44 -0
- package/scripts/r2-storage-canary.mjs +84 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { ReadStream } from 'fs';
|
|
2
|
+
import { OnModuleDestroy, Type, DynamicModule, InjectionToken, OptionalFactoryDependency } from '@nestjs/common';
|
|
3
|
+
|
|
4
|
+
interface UploadOptions {
|
|
5
|
+
contentType?: string;
|
|
6
|
+
metadata?: Record<string, string>;
|
|
7
|
+
acl?: 'private' | 'public-read';
|
|
8
|
+
}
|
|
9
|
+
interface UploadResult {
|
|
10
|
+
key: string;
|
|
11
|
+
/**
|
|
12
|
+
* Stable public URL when the provider is configured for public delivery.
|
|
13
|
+
* Private providers may return an empty string; callers must persist `key`
|
|
14
|
+
* and request a short-lived URL with `getDownloadUrl` when needed.
|
|
15
|
+
*/
|
|
16
|
+
url: string;
|
|
17
|
+
size: number;
|
|
18
|
+
}
|
|
19
|
+
interface FileInfo {
|
|
20
|
+
key: string;
|
|
21
|
+
size: number;
|
|
22
|
+
lastModified: Date;
|
|
23
|
+
contentType?: string;
|
|
24
|
+
/**
|
|
25
|
+
* 文件 MD5 哈希 — 对应 jetlinks FileInfo.md5
|
|
26
|
+
* 用于文件去重和完整性校验
|
|
27
|
+
*/
|
|
28
|
+
md5?: string;
|
|
29
|
+
/**
|
|
30
|
+
* 文件 SHA-256 哈希 — 对应 jetlinks FileInfo.sha256
|
|
31
|
+
*/
|
|
32
|
+
sha256?: string;
|
|
33
|
+
}
|
|
34
|
+
type StorageProviderType = 'local' | 's3' | 'webdav';
|
|
35
|
+
/**
|
|
36
|
+
* 文件上传校验配置
|
|
37
|
+
* 支持后缀名白名单/黑名单和 MIME 类型白名单/黑名单
|
|
38
|
+
*/
|
|
39
|
+
interface FileUploadValidation {
|
|
40
|
+
/** 允许的文件后缀(不含 .),设置后仅这些后缀的文件可上传 */
|
|
41
|
+
allowExtensions?: string[];
|
|
42
|
+
/** 拒绝的文件后缀(不含 .) */
|
|
43
|
+
denyExtensions?: string[];
|
|
44
|
+
/** 允许的 MIME 类型 */
|
|
45
|
+
allowMimeTypes?: string[];
|
|
46
|
+
/** 拒绝的 MIME 类型 */
|
|
47
|
+
denyMimeTypes?: string[];
|
|
48
|
+
/** 最大文件大小(字节),0 表示不限制 */
|
|
49
|
+
maxFileSize?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Default dangerous file extensions that should be blocked unless explicitly allowed.
|
|
53
|
+
*/
|
|
54
|
+
declare const DANGEROUS_EXTENSIONS: readonly string[];
|
|
55
|
+
/**
|
|
56
|
+
* 文件名安全清洗
|
|
57
|
+
*
|
|
58
|
+
* 文件上传安全规则:
|
|
59
|
+
* 1. Unicode NFKC 规范化 — 将不同编码形式的字符统一
|
|
60
|
+
* (如全角字符 `\` → `\`),防止绕过路径检查
|
|
61
|
+
* 2. 将反斜杠统一为正斜杠后仅提取文件名部分
|
|
62
|
+
* 3. 仅允许字母数字和 ._- 组成的文件名用于原始名保留
|
|
63
|
+
*
|
|
64
|
+
* @param fileName 原始文件名
|
|
65
|
+
* @returns 清洗后的安全文件名
|
|
66
|
+
*/
|
|
67
|
+
declare function sanitizeFileName(fileName: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* 检查文件名是否为安全的原始文件名(仅字母数字 ._-)
|
|
70
|
+
*/
|
|
71
|
+
declare function isSafeOriginalFileName(name: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* 判断文件是否被拒绝上传(基于后缀名与 MIME 类型校验)
|
|
74
|
+
* 根据文件名、扩展名和大小检查上传限制。
|
|
75
|
+
*
|
|
76
|
+
* @param fileName 文件名
|
|
77
|
+
* @param mimeType MIME 类型(可选)
|
|
78
|
+
* @param validation 校验配置
|
|
79
|
+
* @param fileSize 文件大小(字节,可选),用于最大文件大小校验
|
|
80
|
+
*/
|
|
81
|
+
declare function isFileDenied(fileName: string, mimeType: string | undefined, validation: FileUploadValidation, fileSize?: number): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* 生成基于日期的存储路径
|
|
84
|
+
* 按 YYYYMMDD 归档,避免单目录文件过多
|
|
85
|
+
*/
|
|
86
|
+
declare function generateDateBasedKey(originalName: string, options?: {
|
|
87
|
+
useOriginalFileName?: boolean;
|
|
88
|
+
prefix?: string;
|
|
89
|
+
}): string;
|
|
90
|
+
/**
|
|
91
|
+
* Chunk upload progress — tracks multipart/chunked upload state.
|
|
92
|
+
*/
|
|
93
|
+
/**
|
|
94
|
+
* POSIX 文件权限配置
|
|
95
|
+
*
|
|
96
|
+
* 使用 Node.js 的 fs.chmod 模式数字设置文件权限。
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* // 所有者可读写,同组用户可读
|
|
101
|
+
* const permissions: PosixFilePermissions = { mode: 0o640 };
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
interface PosixFilePermissions {
|
|
105
|
+
/**
|
|
106
|
+
* POSIX 权限模式(八进制),如 0o644, 0o755
|
|
107
|
+
* 使用标准 POSIX 权限位
|
|
108
|
+
*/
|
|
109
|
+
mode: number;
|
|
110
|
+
}
|
|
111
|
+
interface ChunkUploadState {
|
|
112
|
+
/** Upload session ID */
|
|
113
|
+
uploadId: string;
|
|
114
|
+
/** Target storage key */
|
|
115
|
+
key: string;
|
|
116
|
+
/** Total number of chunks expected */
|
|
117
|
+
totalChunks: number;
|
|
118
|
+
/** Chunks received so far */
|
|
119
|
+
receivedChunks: number[];
|
|
120
|
+
/** Total file size in bytes (if known) */
|
|
121
|
+
totalSize?: number;
|
|
122
|
+
/** Whether the upload is complete */
|
|
123
|
+
complete: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface FileManager {
|
|
126
|
+
readonly providerType: StorageProviderType;
|
|
127
|
+
isConfigured(): boolean;
|
|
128
|
+
upload(buffer: Buffer, key: string, options?: UploadOptions): Promise<UploadResult>;
|
|
129
|
+
uploadStream(stream: ReadStream, key: string, options?: UploadOptions): Promise<UploadResult>;
|
|
130
|
+
download(key: string): Promise<{
|
|
131
|
+
stream: ReadStream;
|
|
132
|
+
size: number;
|
|
133
|
+
}>;
|
|
134
|
+
delete(key: string): Promise<void>;
|
|
135
|
+
exists(key: string): Promise<boolean>;
|
|
136
|
+
getPublicUrl(key: string): Promise<string>;
|
|
137
|
+
getDownloadUrl(key: string, expiresIn?: number): Promise<string>;
|
|
138
|
+
list(prefix: string): Promise<FileInfo[]>;
|
|
139
|
+
/**
|
|
140
|
+
* 获取单个文件的元信息
|
|
141
|
+
* 返回 undefined 表示文件不存在
|
|
142
|
+
*/
|
|
143
|
+
getFileInfo?(key: string): Promise<FileInfo | undefined>;
|
|
144
|
+
/**
|
|
145
|
+
* 从指定偏移量开始读取文件 — 对应 jetlinks FileManager.read(id, position)
|
|
146
|
+
*
|
|
147
|
+
* 支持断点续传和范围读取场景。
|
|
148
|
+
* @param key 存储键
|
|
149
|
+
* @param position 起始偏移量(字节)
|
|
150
|
+
*/
|
|
151
|
+
downloadRange?(key: string, position: number, length?: number): Promise<{
|
|
152
|
+
stream: ReadStream;
|
|
153
|
+
size: number;
|
|
154
|
+
}>;
|
|
155
|
+
/**
|
|
156
|
+
* 复制文件
|
|
157
|
+
*/
|
|
158
|
+
copy?(sourceKey: string, destKey: string): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* 移动/重命名文件
|
|
161
|
+
*/
|
|
162
|
+
move?(sourceKey: string, destKey: string): Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Initialize a chunked/multipart upload session.
|
|
165
|
+
*
|
|
166
|
+
* @param key Target storage key
|
|
167
|
+
* @param totalChunks Total number of chunks expected
|
|
168
|
+
* @param totalSize Total file size in bytes (optional)
|
|
169
|
+
* @returns Upload session ID
|
|
170
|
+
*/
|
|
171
|
+
initChunkedUpload?(key: string, totalChunks: number, totalSize?: number): Promise<string>;
|
|
172
|
+
/**
|
|
173
|
+
* Upload a single chunk in a multipart upload.
|
|
174
|
+
*
|
|
175
|
+
* @param uploadId Upload session ID from initChunkedUpload
|
|
176
|
+
* @param chunkIndex Zero-based chunk index
|
|
177
|
+
* @param buffer Chunk data
|
|
178
|
+
*/
|
|
179
|
+
uploadChunk?(uploadId: string, chunkIndex: number, buffer: Buffer): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Complete a chunked upload, assembling all chunks into the final file.
|
|
182
|
+
*
|
|
183
|
+
* @param uploadId Upload session ID
|
|
184
|
+
* @param options Optional upload options (contentType, metadata, acl)
|
|
185
|
+
* @returns Upload result with final URL
|
|
186
|
+
*/
|
|
187
|
+
completeChunkedUpload?(uploadId: string, options?: UploadOptions): Promise<UploadResult>;
|
|
188
|
+
/**
|
|
189
|
+
* Abort a chunked upload, cleaning up any temporary chunks.
|
|
190
|
+
*
|
|
191
|
+
* @param uploadId Upload session ID
|
|
192
|
+
*/
|
|
193
|
+
abortChunkedUpload?(uploadId: string): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* 便捷文件保存
|
|
196
|
+
*
|
|
197
|
+
* 自动根据文件类型生成日期归档路径并保存,简化调用方使用。
|
|
198
|
+
* 内部调用 generateDateBasedKey + upload。
|
|
199
|
+
*
|
|
200
|
+
* @param buffer 文件内容
|
|
201
|
+
* @param fileType 文件类型/后缀(如 "png", ".jpg")
|
|
202
|
+
* @param options 上传选项
|
|
203
|
+
* @returns 上传结果
|
|
204
|
+
*/
|
|
205
|
+
saveFile?(buffer: Buffer, fileType: string, options?: UploadOptions): Promise<UploadResult>;
|
|
206
|
+
/**
|
|
207
|
+
* 应用 POSIX 文件权限
|
|
208
|
+
*
|
|
209
|
+
* 在文件写入后设置 POSIX 权限(仅对本地存储有效,S3/WebDAV 忽略)。
|
|
210
|
+
* 这里使用 Node.js fs.chmodSync() 实现。
|
|
211
|
+
*
|
|
212
|
+
* @param key 存储键
|
|
213
|
+
* @param permissions POSIX 权限配置
|
|
214
|
+
*/
|
|
215
|
+
applyFilePermission?(key: string, permissions: PosixFilePermissions): Promise<void>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
declare class LocalFileStorage implements FileManager {
|
|
219
|
+
private readonly logger;
|
|
220
|
+
readonly providerType: "local";
|
|
221
|
+
private readonly basePath;
|
|
222
|
+
private readonly baseUrl;
|
|
223
|
+
/** Active chunked upload sessions */
|
|
224
|
+
private readonly chunkedUploads;
|
|
225
|
+
constructor(options: {
|
|
226
|
+
basePath: string;
|
|
227
|
+
baseUrl?: string;
|
|
228
|
+
});
|
|
229
|
+
isConfigured(): boolean;
|
|
230
|
+
upload(buffer: Buffer, key: string, _options?: UploadOptions): Promise<UploadResult>;
|
|
231
|
+
uploadStream(stream: ReadStream, key: string, options?: UploadOptions): Promise<UploadResult>;
|
|
232
|
+
download(key: string): Promise<{
|
|
233
|
+
stream: ReadStream;
|
|
234
|
+
size: number;
|
|
235
|
+
}>;
|
|
236
|
+
delete(key: string): Promise<void>;
|
|
237
|
+
exists(key: string): Promise<boolean>;
|
|
238
|
+
getPublicUrl(key: string): Promise<string>;
|
|
239
|
+
getDownloadUrl(key: string): Promise<string>;
|
|
240
|
+
list(prefix: string): Promise<FileInfo[]>;
|
|
241
|
+
downloadRange(key: string, position: number, length?: number): Promise<{
|
|
242
|
+
stream: ReadStream;
|
|
243
|
+
size: number;
|
|
244
|
+
}>;
|
|
245
|
+
getFileInfo(key: string): Promise<FileInfo | undefined>;
|
|
246
|
+
copy(sourceKey: string, destKey: string): Promise<void>;
|
|
247
|
+
move(sourceKey: string, destKey: string): Promise<void>;
|
|
248
|
+
initChunkedUpload(key: string, totalChunks: number, totalSize?: number): Promise<string>;
|
|
249
|
+
uploadChunk(uploadId: string, chunkIndex: number, buffer: Buffer): Promise<void>;
|
|
250
|
+
completeChunkedUpload(uploadId: string, _options?: UploadOptions): Promise<UploadResult>;
|
|
251
|
+
abortChunkedUpload(uploadId: string): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* 便捷文件保存
|
|
254
|
+
* 自动根据文件类型生成日期归档路径并保存。
|
|
255
|
+
*/
|
|
256
|
+
saveFile(buffer: Buffer, fileType: string, options?: UploadOptions): Promise<UploadResult>;
|
|
257
|
+
/**
|
|
258
|
+
* 应用 POSIX 文件权限
|
|
259
|
+
* 使用 fs.chmodSync 设置文件权限,非 POSIX 系统静默忽略错误。
|
|
260
|
+
*/
|
|
261
|
+
applyFilePermission(key: string, permissions: PosixFilePermissions): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* Resolve a storage key to an absolute file path.
|
|
264
|
+
* Validates against path traversal attacks (e.g. "../../../etc/passwd").
|
|
265
|
+
*/
|
|
266
|
+
private resolvePath;
|
|
267
|
+
private buildUrl;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
type S3ObjectAclMode = 'object-acl' | 'none';
|
|
271
|
+
type S3UploadUrlMode = 'signed' | 'public-only';
|
|
272
|
+
interface S3StorageOptions {
|
|
273
|
+
accessKeyId: string;
|
|
274
|
+
secretAccessKey: string;
|
|
275
|
+
region?: string;
|
|
276
|
+
endpoint?: string;
|
|
277
|
+
bucket: string;
|
|
278
|
+
publicUrl?: string;
|
|
279
|
+
forcePathStyle?: boolean;
|
|
280
|
+
objectAclMode?: S3ObjectAclMode;
|
|
281
|
+
uploadUrlMode?: S3UploadUrlMode;
|
|
282
|
+
signedUrlExpiresIn?: number;
|
|
283
|
+
}
|
|
284
|
+
declare class S3Storage implements FileManager, OnModuleDestroy {
|
|
285
|
+
private readonly logger;
|
|
286
|
+
private readonly client;
|
|
287
|
+
private readonly bucket;
|
|
288
|
+
private readonly publicUrl;
|
|
289
|
+
private readonly objectAclMode;
|
|
290
|
+
private readonly uploadUrlMode;
|
|
291
|
+
private readonly signedUrlExpiresIn;
|
|
292
|
+
readonly providerType: "s3";
|
|
293
|
+
constructor(options: S3StorageOptions);
|
|
294
|
+
onModuleDestroy(): void;
|
|
295
|
+
isConfigured(): boolean;
|
|
296
|
+
upload(buffer: Buffer, key: string, options?: UploadOptions): Promise<UploadResult>;
|
|
297
|
+
uploadStream(stream: ReadStream, key: string, options?: UploadOptions): Promise<UploadResult>;
|
|
298
|
+
download(key: string): Promise<{
|
|
299
|
+
stream: ReadStream;
|
|
300
|
+
size: number;
|
|
301
|
+
}>;
|
|
302
|
+
delete(key: string): Promise<void>;
|
|
303
|
+
exists(key: string): Promise<boolean>;
|
|
304
|
+
getPublicUrl(key: string): Promise<string>;
|
|
305
|
+
getDownloadUrl(key: string, expiresIn?: number): Promise<string>;
|
|
306
|
+
list(prefix: string): Promise<FileInfo[]>;
|
|
307
|
+
getFileInfo(key: string): Promise<FileInfo | undefined>;
|
|
308
|
+
copy(sourceKey: string, destKey: string): Promise<void>;
|
|
309
|
+
move(sourceKey: string, destKey: string): Promise<void>;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
interface WebDavStorageOptions {
|
|
313
|
+
/** WebDAV 服务地址,如 https://nextcloud.example.com/remote.php/dav/files/user */
|
|
314
|
+
url: string;
|
|
315
|
+
username: string;
|
|
316
|
+
password: string;
|
|
317
|
+
/** 公开访问 URL 前缀(可选) */
|
|
318
|
+
publicUrl?: string;
|
|
319
|
+
/** 基础路径前缀(可选,默认 '/') */
|
|
320
|
+
basePath?: string;
|
|
321
|
+
}
|
|
322
|
+
declare class WebDavStorage implements FileManager {
|
|
323
|
+
private readonly logger;
|
|
324
|
+
private clientPromise?;
|
|
325
|
+
private readonly publicUrl;
|
|
326
|
+
private readonly basePath;
|
|
327
|
+
private readonly directoryPromises;
|
|
328
|
+
readonly providerType: "webdav";
|
|
329
|
+
private readonly options;
|
|
330
|
+
constructor(options: WebDavStorageOptions);
|
|
331
|
+
private initClient;
|
|
332
|
+
private getClient;
|
|
333
|
+
isConfigured(): boolean;
|
|
334
|
+
upload(buffer: Buffer, key: string, options?: UploadOptions): Promise<UploadResult>;
|
|
335
|
+
uploadStream(stream: ReadStream, key: string, options?: UploadOptions): Promise<UploadResult>;
|
|
336
|
+
download(key: string): Promise<{
|
|
337
|
+
stream: ReadStream;
|
|
338
|
+
size: number;
|
|
339
|
+
}>;
|
|
340
|
+
delete(key: string): Promise<void>;
|
|
341
|
+
exists(key: string): Promise<boolean>;
|
|
342
|
+
getPublicUrl(key: string): Promise<string>;
|
|
343
|
+
getDownloadUrl(key: string): Promise<string>;
|
|
344
|
+
list(prefix: string): Promise<FileInfo[]>;
|
|
345
|
+
getFileInfo(key: string): Promise<FileInfo | undefined>;
|
|
346
|
+
copy(sourceKey: string, destKey: string): Promise<void>;
|
|
347
|
+
move(sourceKey: string, destKey: string): Promise<void>;
|
|
348
|
+
/**
|
|
349
|
+
* 递归创建目录
|
|
350
|
+
*/
|
|
351
|
+
private ensureDirectory;
|
|
352
|
+
private createDirectoryIfMissing;
|
|
353
|
+
private resolvePath;
|
|
354
|
+
private stripBasePath;
|
|
355
|
+
private buildUrl;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* 文件生命周期管理器。
|
|
360
|
+
*
|
|
361
|
+
* 支持文件过期自动清理、临时文件管理、存储配额检查。
|
|
362
|
+
*/
|
|
363
|
+
interface FileLifecyclePolicy {
|
|
364
|
+
/** 文件最大保留时间(毫秒),0 表示永久 */
|
|
365
|
+
maxAge?: number;
|
|
366
|
+
/** 文件最大数量,超出后按 FIFO 清理 */
|
|
367
|
+
maxCount?: number;
|
|
368
|
+
/** 文件最大总大小(字节),超出后按 FIFO 清理 */
|
|
369
|
+
maxTotalSize?: number;
|
|
370
|
+
/** 文件路径前缀匹配(用于作用域限定) */
|
|
371
|
+
pathPrefix?: string;
|
|
372
|
+
}
|
|
373
|
+
interface FileMetadata {
|
|
374
|
+
key: string;
|
|
375
|
+
size: number;
|
|
376
|
+
createdAt: number;
|
|
377
|
+
lastAccessedAt?: number;
|
|
378
|
+
contentType?: string;
|
|
379
|
+
tags?: Record<string, string>;
|
|
380
|
+
}
|
|
381
|
+
interface LifecycleResult {
|
|
382
|
+
deletedCount: number;
|
|
383
|
+
freedBytes: number;
|
|
384
|
+
reason: 'expired' | 'count_exceeded' | 'size_exceeded';
|
|
385
|
+
}
|
|
386
|
+
declare class FileLifecycleManager {
|
|
387
|
+
private readonly logger;
|
|
388
|
+
private readonly policies;
|
|
389
|
+
/** 注册一个生命周期策略 */
|
|
390
|
+
registerPolicy(policy: FileLifecyclePolicy): void;
|
|
391
|
+
/** 获取所有已注册策略 */
|
|
392
|
+
getPolicies(): FileLifecyclePolicy[];
|
|
393
|
+
/**
|
|
394
|
+
* 评估文件列表,返回需要清理的文件 keys。
|
|
395
|
+
* 调用方负责实际删除操作。
|
|
396
|
+
*/
|
|
397
|
+
evaluate(files: FileMetadata[], policy?: FileLifecyclePolicy): string[];
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
declare const FILE_MANAGER = "FILE_MANAGER";
|
|
401
|
+
type StorageModuleOptions = {
|
|
402
|
+
provider: 'local';
|
|
403
|
+
basePath: string;
|
|
404
|
+
baseUrl?: string;
|
|
405
|
+
} | ({
|
|
406
|
+
provider: 's3';
|
|
407
|
+
} & S3StorageOptions) | ({
|
|
408
|
+
provider: 'webdav';
|
|
409
|
+
} & WebDavStorageOptions);
|
|
410
|
+
interface StorageModuleAsyncOptions {
|
|
411
|
+
imports?: Array<Type | DynamicModule>;
|
|
412
|
+
useFactory?: (...args: unknown[]) => StorageModuleOptions | Promise<StorageModuleOptions>;
|
|
413
|
+
useClass?: Type<StorageModuleOptionsFactory>;
|
|
414
|
+
useExisting?: Type<StorageModuleOptionsFactory>;
|
|
415
|
+
inject?: Array<InjectionToken | OptionalFactoryDependency>;
|
|
416
|
+
}
|
|
417
|
+
interface StorageModuleOptionsFactory {
|
|
418
|
+
createStorageOptions(): StorageModuleOptions | Promise<StorageModuleOptions>;
|
|
419
|
+
}
|
|
420
|
+
declare class ZuckerStorageModule {
|
|
421
|
+
static forRoot(options: StorageModuleOptions): DynamicModule;
|
|
422
|
+
static forRootAsync(options: StorageModuleAsyncOptions): DynamicModule;
|
|
423
|
+
private static createFileManager;
|
|
424
|
+
private static createAsyncProviders;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
declare enum StorageProvider {
|
|
428
|
+
LOCAL = "LOCAL",
|
|
429
|
+
S3 = "S3",
|
|
430
|
+
WEBDAV = "WEBDAV"
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export { type ChunkUploadState, DANGEROUS_EXTENSIONS, FILE_MANAGER, type FileInfo, FileLifecycleManager, type FileLifecyclePolicy, type FileManager, type FileMetadata, type FileUploadValidation, type LifecycleResult, LocalFileStorage, type PosixFilePermissions, type S3ObjectAclMode, S3Storage, type S3StorageOptions, type S3UploadUrlMode, type StorageModuleAsyncOptions, type StorageModuleOptions, type StorageModuleOptionsFactory, StorageProvider, type StorageProviderType, type UploadOptions, type UploadResult, WebDavStorage, type WebDavStorageOptions, ZuckerStorageModule, generateDateBasedKey, isFileDenied, isSafeOriginalFileName, sanitizeFileName };
|