express-storage 2.0.2 → 3.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/README.md +366 -34
- package/dist/cjs/config/index.d.ts +10 -0
- package/dist/cjs/config/index.d.ts.map +1 -0
- package/dist/cjs/config/index.js +19 -0
- package/dist/cjs/config/index.js.map +1 -0
- package/dist/cjs/drivers/azure.driver.d.ts +73 -0
- package/dist/cjs/drivers/azure.driver.d.ts.map +1 -0
- package/dist/cjs/drivers/azure.driver.js +390 -0
- package/dist/cjs/drivers/azure.driver.js.map +1 -0
- package/dist/cjs/drivers/base.driver.d.ts +136 -0
- package/dist/cjs/drivers/base.driver.d.ts.map +1 -0
- package/dist/cjs/drivers/base.driver.js +357 -0
- package/dist/cjs/drivers/base.driver.js.map +1 -0
- package/dist/{drivers → cjs/drivers}/gcs.driver.d.ts +20 -38
- package/dist/cjs/drivers/gcs.driver.d.ts.map +1 -0
- package/dist/cjs/drivers/gcs.driver.js +343 -0
- package/dist/cjs/drivers/gcs.driver.js.map +1 -0
- package/dist/cjs/drivers/index.d.ts +15 -0
- package/dist/cjs/drivers/index.d.ts.map +1 -0
- package/dist/cjs/drivers/index.js +26 -0
- package/dist/cjs/drivers/index.js.map +1 -0
- package/dist/cjs/drivers/local.driver.d.ts +86 -0
- package/dist/cjs/drivers/local.driver.d.ts.map +1 -0
- package/dist/cjs/drivers/local.driver.js +556 -0
- package/dist/cjs/drivers/local.driver.js.map +1 -0
- package/dist/{drivers → cjs/drivers}/s3.driver.d.ts +19 -39
- package/dist/cjs/drivers/s3.driver.d.ts.map +1 -0
- package/dist/cjs/drivers/s3.driver.js +400 -0
- package/dist/cjs/drivers/s3.driver.js.map +1 -0
- package/dist/cjs/factory/driver.factory.d.ts +43 -0
- package/dist/cjs/factory/driver.factory.d.ts.map +1 -0
- package/dist/cjs/factory/driver.factory.js +101 -0
- package/dist/cjs/factory/driver.factory.js.map +1 -0
- package/dist/cjs/index.d.ts +26 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +31 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/storage-manager.d.ts +210 -0
- package/dist/cjs/storage-manager.d.ts.map +1 -0
- package/dist/cjs/storage-manager.js +649 -0
- package/dist/cjs/storage-manager.js.map +1 -0
- package/dist/cjs/types/storage.types.d.ts +438 -0
- package/dist/cjs/types/storage.types.d.ts.map +1 -0
- package/dist/cjs/types/storage.types.js +3 -0
- package/dist/cjs/types/storage.types.js.map +1 -0
- package/dist/cjs/utils/config.utils.d.ts.map +1 -0
- package/dist/cjs/utils/config.utils.js +213 -0
- package/dist/cjs/utils/config.utils.js.map +1 -0
- package/dist/{utils → cjs/utils}/file.utils.d.ts +62 -8
- package/dist/cjs/utils/file.utils.d.ts.map +1 -0
- package/dist/cjs/utils/file.utils.js +464 -0
- package/dist/cjs/utils/file.utils.js.map +1 -0
- package/dist/cjs/utils/index.d.ts +12 -0
- package/dist/cjs/utils/index.d.ts.map +1 -0
- package/dist/cjs/utils/index.js +36 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/rate-limiter.d.ts +40 -0
- package/dist/cjs/utils/rate-limiter.d.ts.map +1 -0
- package/dist/cjs/utils/rate-limiter.js +87 -0
- package/dist/cjs/utils/rate-limiter.js.map +1 -0
- package/dist/esm/config/index.d.ts +10 -0
- package/dist/esm/config/index.d.ts.map +1 -0
- package/dist/esm/config/index.js +10 -0
- package/dist/esm/config/index.js.map +1 -0
- package/dist/esm/drivers/azure.driver.d.ts +73 -0
- package/dist/esm/drivers/azure.driver.d.ts.map +1 -0
- package/dist/esm/drivers/azure.driver.js +353 -0
- package/dist/esm/drivers/azure.driver.js.map +1 -0
- package/dist/esm/drivers/base.driver.d.ts +136 -0
- package/dist/esm/drivers/base.driver.d.ts.map +1 -0
- package/dist/esm/drivers/base.driver.js +350 -0
- package/dist/esm/drivers/base.driver.js.map +1 -0
- package/dist/esm/drivers/gcs.driver.d.ts +68 -0
- package/dist/esm/drivers/gcs.driver.d.ts.map +1 -0
- package/dist/esm/drivers/gcs.driver.js +306 -0
- package/dist/esm/drivers/gcs.driver.js.map +1 -0
- package/dist/esm/drivers/index.d.ts +15 -0
- package/dist/esm/drivers/index.d.ts.map +1 -0
- package/dist/esm/drivers/index.js +15 -0
- package/dist/esm/drivers/index.js.map +1 -0
- package/dist/esm/drivers/local.driver.d.ts +86 -0
- package/dist/esm/drivers/local.driver.d.ts.map +1 -0
- package/dist/esm/drivers/local.driver.js +549 -0
- package/dist/esm/drivers/local.driver.js.map +1 -0
- package/dist/esm/drivers/s3.driver.d.ts +69 -0
- package/dist/esm/drivers/s3.driver.d.ts.map +1 -0
- package/dist/esm/drivers/s3.driver.js +363 -0
- package/dist/esm/drivers/s3.driver.js.map +1 -0
- package/dist/esm/factory/driver.factory.d.ts +43 -0
- package/dist/esm/factory/driver.factory.d.ts.map +1 -0
- package/dist/esm/factory/driver.factory.js +92 -0
- package/dist/esm/factory/driver.factory.js.map +1 -0
- package/dist/esm/index.d.ts +26 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +26 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/storage-manager.d.ts +210 -0
- package/dist/esm/storage-manager.d.ts.map +1 -0
- package/dist/esm/storage-manager.js +645 -0
- package/dist/esm/storage-manager.js.map +1 -0
- package/dist/esm/types/storage.types.d.ts +438 -0
- package/dist/esm/types/storage.types.d.ts.map +1 -0
- package/dist/esm/types/storage.types.js.map +1 -0
- package/dist/esm/utils/config.utils.d.ts +45 -0
- package/dist/esm/utils/config.utils.d.ts.map +1 -0
- package/dist/esm/utils/config.utils.js.map +1 -0
- package/dist/esm/utils/file.utils.d.ts +196 -0
- package/dist/esm/utils/file.utils.d.ts.map +1 -0
- package/dist/esm/utils/file.utils.js +439 -0
- package/dist/esm/utils/file.utils.js.map +1 -0
- package/dist/esm/utils/index.d.ts +12 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/index.js +11 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/rate-limiter.d.ts +40 -0
- package/dist/esm/utils/rate-limiter.d.ts.map +1 -0
- package/dist/esm/utils/rate-limiter.js +82 -0
- package/dist/esm/utils/rate-limiter.js.map +1 -0
- package/package.json +90 -52
- package/src/config/index.ts +17 -0
- package/src/drivers/azure.driver.ts +434 -0
- package/src/drivers/base.driver.ts +436 -0
- package/src/drivers/gcs.driver.ts +366 -0
- package/src/drivers/index.ts +15 -0
- package/src/drivers/local.driver.ts +626 -0
- package/src/drivers/s3.driver.ts +459 -0
- package/src/factory/driver.factory.ts +101 -0
- package/src/index.ts +72 -0
- package/src/storage-manager.ts +801 -0
- package/src/types/storage.types.ts +561 -0
- package/src/utils/config.utils.ts +229 -0
- package/src/utils/file.utils.ts +536 -0
- package/src/utils/index.ts +35 -0
- package/src/utils/rate-limiter.ts +94 -0
- package/dist/drivers/azure.driver.d.ts +0 -88
- package/dist/drivers/azure.driver.d.ts.map +0 -1
- package/dist/drivers/azure.driver.js +0 -391
- package/dist/drivers/azure.driver.js.map +0 -1
- package/dist/drivers/base.driver.d.ts +0 -170
- package/dist/drivers/base.driver.d.ts.map +0 -1
- package/dist/drivers/base.driver.js +0 -347
- package/dist/drivers/base.driver.js.map +0 -1
- package/dist/drivers/gcs.driver.d.ts.map +0 -1
- package/dist/drivers/gcs.driver.js +0 -354
- package/dist/drivers/gcs.driver.js.map +0 -1
- package/dist/drivers/local.driver.d.ts +0 -107
- package/dist/drivers/local.driver.d.ts.map +0 -1
- package/dist/drivers/local.driver.js +0 -621
- package/dist/drivers/local.driver.js.map +0 -1
- package/dist/drivers/s3.driver.d.ts.map +0 -1
- package/dist/drivers/s3.driver.js +0 -387
- package/dist/drivers/s3.driver.js.map +0 -1
- package/dist/factory/driver.factory.d.ts +0 -62
- package/dist/factory/driver.factory.d.ts.map +0 -1
- package/dist/factory/driver.factory.js +0 -177
- package/dist/factory/driver.factory.js.map +0 -1
- package/dist/index.d.ts +0 -30
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -33
- package/dist/index.js.map +0 -1
- package/dist/storage-manager.d.ts +0 -228
- package/dist/storage-manager.d.ts.map +0 -1
- package/dist/storage-manager.js +0 -715
- package/dist/storage-manager.js.map +0 -1
- package/dist/types/storage.types.d.ts +0 -295
- package/dist/types/storage.types.d.ts.map +0 -1
- package/dist/types/storage.types.js.map +0 -1
- package/dist/utils/config.utils.d.ts.map +0 -1
- package/dist/utils/config.utils.js.map +0 -1
- package/dist/utils/file.utils.d.ts.map +0 -1
- package/dist/utils/file.utils.js +0 -278
- package/dist/utils/file.utils.js.map +0 -1
- /package/dist/{utils → cjs/utils}/config.utils.d.ts +0 -0
- /package/dist/{types → esm/types}/storage.types.js +0 -0
- /package/dist/{utils → esm/utils}/config.utils.js +0 -0
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { Readable } from 'stream';
|
|
2
|
-
import { IStorageDriver, FileUploadResult, PresignedUrlResult, StorageConfig, BlobValidationOptions, BlobValidationResult, ListFilesResult, UploadOptions, DeleteResult } from '../types/storage.types.js';
|
|
3
|
-
/**
|
|
4
|
-
* BaseStorageDriver - The foundation that all storage drivers build upon.
|
|
5
|
-
*
|
|
6
|
-
* This abstract class provides common functionality that every driver needs:
|
|
7
|
-
* filename generation, file validation, content reading, and result formatting.
|
|
8
|
-
*
|
|
9
|
-
* If you're building a custom driver, extend this class and implement the
|
|
10
|
-
* abstract methods. You'll get all the helper methods for free.
|
|
11
|
-
*/
|
|
12
|
-
export declare abstract class BaseStorageDriver implements IStorageDriver {
|
|
13
|
-
protected config: StorageConfig;
|
|
14
|
-
constructor(config: StorageConfig);
|
|
15
|
-
/**
|
|
16
|
-
* Builds the full storage path by combining the bucket path with the filename.
|
|
17
|
-
* For example: 'uploads' + 'photo.jpg' = 'uploads/photo.jpg'
|
|
18
|
-
*/
|
|
19
|
-
protected buildFilePath(fileName: string): string;
|
|
20
|
-
/**
|
|
21
|
-
* Returns the configured bucket path, cleaned up and ready to use.
|
|
22
|
-
*/
|
|
23
|
-
protected getBucketPath(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Uploads a single file. Each driver implements this differently.
|
|
26
|
-
*/
|
|
27
|
-
abstract upload(file: Express.Multer.File, options?: UploadOptions): Promise<FileUploadResult>;
|
|
28
|
-
/**
|
|
29
|
-
* Uploads multiple files with smart concurrency control.
|
|
30
|
-
* Processes up to 10 files at a time to balance speed and system resources.
|
|
31
|
-
*/
|
|
32
|
-
uploadMultiple(files: Express.Multer.File[], options?: UploadOptions): Promise<FileUploadResult[]>;
|
|
33
|
-
/**
|
|
34
|
-
* Creates a presigned URL for uploading.
|
|
35
|
-
* Each cloud provider has its own way of doing this.
|
|
36
|
-
*/
|
|
37
|
-
abstract generateUploadUrl(fileName: string, contentType?: string, fileSize?: number): Promise<PresignedUrlResult>;
|
|
38
|
-
/**
|
|
39
|
-
* Creates a presigned URL for viewing/downloading.
|
|
40
|
-
*/
|
|
41
|
-
abstract generateViewUrl(fileName: string): Promise<PresignedUrlResult>;
|
|
42
|
-
/**
|
|
43
|
-
* Deletes a file from storage.
|
|
44
|
-
*/
|
|
45
|
-
abstract delete(fileName: string): Promise<boolean>;
|
|
46
|
-
/**
|
|
47
|
-
* Lists files with optional filtering and pagination.
|
|
48
|
-
*/
|
|
49
|
-
abstract listFiles(prefix?: string, maxResults?: number, continuationToken?: string): Promise<ListFilesResult>;
|
|
50
|
-
/**
|
|
51
|
-
* Deletes multiple files with smart concurrency control.
|
|
52
|
-
* Returns detailed results so you know exactly what happened with each file.
|
|
53
|
-
*/
|
|
54
|
-
deleteMultiple(fileNames: string[]): Promise<DeleteResult[]>;
|
|
55
|
-
/**
|
|
56
|
-
* Creates a unique filename that won't collide with existing files.
|
|
57
|
-
* Format: {timestamp}_{random}_{original_name}.{ext}
|
|
58
|
-
*/
|
|
59
|
-
protected generateFileName(originalName: string): string;
|
|
60
|
-
/**
|
|
61
|
-
* Builds a success response for upload operations.
|
|
62
|
-
*/
|
|
63
|
-
protected createSuccessResult(fileName: string, fileUrl?: string): FileUploadResult;
|
|
64
|
-
/**
|
|
65
|
-
* Builds an error response for upload operations.
|
|
66
|
-
*/
|
|
67
|
-
protected createErrorResult(error: string): FileUploadResult;
|
|
68
|
-
/**
|
|
69
|
-
* Builds a success response for presigned URL operations.
|
|
70
|
-
*/
|
|
71
|
-
protected createPresignedSuccessResult(uploadUrl?: string, viewUrl?: string): PresignedUrlResult;
|
|
72
|
-
/**
|
|
73
|
-
* Builds an error response for presigned URL operations.
|
|
74
|
-
*/
|
|
75
|
-
protected createPresignedErrorResult(error: string): PresignedUrlResult;
|
|
76
|
-
/**
|
|
77
|
-
* Validates a file before upload.
|
|
78
|
-
*
|
|
79
|
-
* Checks for common issues:
|
|
80
|
-
* - Missing file
|
|
81
|
-
* - No original name
|
|
82
|
-
* - No MIME type
|
|
83
|
-
* - Empty content
|
|
84
|
-
*
|
|
85
|
-
* Works with both Multer memory storage (file.buffer) and disk storage (file.path).
|
|
86
|
-
*/
|
|
87
|
-
protected validateFile(file: Express.Multer.File): string[];
|
|
88
|
-
/**
|
|
89
|
-
* Reads the file content, whether it's in memory or on disk.
|
|
90
|
-
*
|
|
91
|
-
* Note: For disk storage, this reads the file but doesn't delete it.
|
|
92
|
-
* Call cleanupTempFile() afterward if you need to remove the temp file.
|
|
93
|
-
*
|
|
94
|
-
* @warning **MEMORY IMPLICATIONS**: This method loads the ENTIRE file into memory.
|
|
95
|
-
* For large files, this can cause memory exhaustion and application crashes.
|
|
96
|
-
*
|
|
97
|
-
* **ALWAYS call `shouldUseStreaming(file)` first** and use `getFileStream()`
|
|
98
|
-
* for files larger than 100MB. Example:
|
|
99
|
-
*
|
|
100
|
-
* ```typescript
|
|
101
|
-
* if (this.shouldUseStreaming(file)) {
|
|
102
|
-
* return this.uploadWithStream(file);
|
|
103
|
-
* }
|
|
104
|
-
* const content = this.getFileContent(file); // Safe for smaller files
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* Memory usage: A 1GB file will allocate ~1GB of heap memory.
|
|
108
|
-
* Node.js default heap limit is ~1.5GB, so large files WILL crash your app.
|
|
109
|
-
*
|
|
110
|
-
* @param file - The Multer file object
|
|
111
|
-
* @returns Buffer containing the entire file contents
|
|
112
|
-
* @throws Error if file has neither buffer nor path
|
|
113
|
-
*/
|
|
114
|
-
protected getFileContent(file: Express.Multer.File): Buffer;
|
|
115
|
-
/**
|
|
116
|
-
* Returns a readable stream for the file content.
|
|
117
|
-
*
|
|
118
|
-
* Use this instead of getFileContent() for large files to avoid
|
|
119
|
-
* loading the entire file into memory. Particularly useful for
|
|
120
|
-
* files larger than 100MB.
|
|
121
|
-
*
|
|
122
|
-
* @param file - The Multer file object
|
|
123
|
-
* @returns A readable stream of the file content
|
|
124
|
-
*/
|
|
125
|
-
protected getFileStream(file: Express.Multer.File): Readable;
|
|
126
|
-
/**
|
|
127
|
-
* Determines if a file should use streaming based on its size.
|
|
128
|
-
*
|
|
129
|
-
* Files larger than 100MB benefit from streaming to reduce memory usage.
|
|
130
|
-
*
|
|
131
|
-
* @param file - The Multer file object
|
|
132
|
-
* @returns true if the file should use streaming
|
|
133
|
-
*/
|
|
134
|
-
protected shouldUseStreaming(file: Express.Multer.File): boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Gets the file size, reading from disk if necessary.
|
|
137
|
-
*
|
|
138
|
-
* @param file - The Multer file object
|
|
139
|
-
* @returns The file size in bytes
|
|
140
|
-
*/
|
|
141
|
-
protected getFileSize(file: Express.Multer.File): number;
|
|
142
|
-
/**
|
|
143
|
-
* Removes a temporary file created by Multer disk storage.
|
|
144
|
-
*
|
|
145
|
-
* Call this after a successful upload if you're using disk storage
|
|
146
|
-
* and want to clean up. Memory storage doesn't need this — the
|
|
147
|
-
* garbage collector handles cleanup automatically.
|
|
148
|
-
*
|
|
149
|
-
* @returns true if the file was deleted, false otherwise
|
|
150
|
-
*/
|
|
151
|
-
cleanupTempFile(file: Express.Multer.File): boolean;
|
|
152
|
-
/**
|
|
153
|
-
* Returns how long presigned URLs should be valid (in seconds).
|
|
154
|
-
*
|
|
155
|
-
* Clamps the value to stay within cloud provider limits:
|
|
156
|
-
* - Minimum: 1 second
|
|
157
|
-
* - Maximum: 7 days (604800 seconds)
|
|
158
|
-
* - Default: 10 minutes (600 seconds)
|
|
159
|
-
*/
|
|
160
|
-
protected getPresignedUrlExpiry(): number;
|
|
161
|
-
/**
|
|
162
|
-
* Confirms that an upload completed successfully.
|
|
163
|
-
*
|
|
164
|
-
* The default implementation just checks if the file exists.
|
|
165
|
-
* Azure overrides this to validate file properties since Azure
|
|
166
|
-
* doesn't enforce constraints at the presigned URL level.
|
|
167
|
-
*/
|
|
168
|
-
validateAndConfirmUpload(reference: string, _options?: BlobValidationOptions): Promise<BlobValidationResult>;
|
|
169
|
-
}
|
|
170
|
-
//# sourceMappingURL=base.driver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.driver.d.ts","sourceRoot":"","sources":["../../src/drivers/base.driver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM3M;;;;;;;;GAQG;AACH,8BAAsB,iBAAkB,YAAW,cAAc;IAC/D,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC;gBAEpB,MAAM,EAAE,aAAa;IAIjC;;;OAGG;IACH,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IASjD;;OAEG;IACH,SAAS,CAAC,aAAa,IAAI,MAAM;IAIjC;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC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kBAAkB;IAahG;;OAEG;IACH,SAAS,CAAC,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB;IAOvE;;;;;;;;;;OAUG;IACH,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,EAAE;IA6C3D;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM;IAY3D;;;;;;;;;OASG;IACH,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,QAAQ;IAY5D;;;;;;;OAOG;IACH,SAAS,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,OAAO;IAKhE;;;;;OAKG;IACH,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM;IAqBxD;;;;;;;;OAQG;IACI,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,OAAO;IAY1D;;;;;;;OAOG;IACH,SAAS,CAAC,qBAAqB,IAAI,MAAM;IAqBzC;;;;;;OAMG;IACG,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAoBnH"}
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import { Readable } from 'stream';
|
|
3
|
-
import { generateUniqueFileName, withConcurrencyLimit } from '../utils/file.utils.js';
|
|
4
|
-
/** Threshold for using streaming uploads (100MB) */
|
|
5
|
-
const STREAM_THRESHOLD = 100 * 1024 * 1024;
|
|
6
|
-
/**
|
|
7
|
-
* BaseStorageDriver - The foundation that all storage drivers build upon.
|
|
8
|
-
*
|
|
9
|
-
* This abstract class provides common functionality that every driver needs:
|
|
10
|
-
* filename generation, file validation, content reading, and result formatting.
|
|
11
|
-
*
|
|
12
|
-
* If you're building a custom driver, extend this class and implement the
|
|
13
|
-
* abstract methods. You'll get all the helper methods for free.
|
|
14
|
-
*/
|
|
15
|
-
export class BaseStorageDriver {
|
|
16
|
-
constructor(config) {
|
|
17
|
-
this.config = config;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Builds the full storage path by combining the bucket path with the filename.
|
|
21
|
-
* For example: 'uploads' + 'photo.jpg' = 'uploads/photo.jpg'
|
|
22
|
-
*/
|
|
23
|
-
buildFilePath(fileName) {
|
|
24
|
-
const bucketPath = this.config.bucketPath?.trim();
|
|
25
|
-
if (!bucketPath || bucketPath === '' || bucketPath === '/') {
|
|
26
|
-
return fileName;
|
|
27
|
-
}
|
|
28
|
-
const normalizedPath = bucketPath.replace(/^\/+|\/+$/g, '');
|
|
29
|
-
return `${normalizedPath}/${fileName}`;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Returns the configured bucket path, cleaned up and ready to use.
|
|
33
|
-
*/
|
|
34
|
-
getBucketPath() {
|
|
35
|
-
return this.config.bucketPath?.trim()?.replace(/^\/+|\/+$/g, '') || '';
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Uploads multiple files with smart concurrency control.
|
|
39
|
-
* Processes up to 10 files at a time to balance speed and system resources.
|
|
40
|
-
*/
|
|
41
|
-
async uploadMultiple(files, options) {
|
|
42
|
-
if (!files || files.length === 0) {
|
|
43
|
-
return [];
|
|
44
|
-
}
|
|
45
|
-
return withConcurrencyLimit(files, async (file) => {
|
|
46
|
-
try {
|
|
47
|
-
return await this.upload(file, options);
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
return {
|
|
51
|
-
success: false,
|
|
52
|
-
error: error instanceof Error ? error.message : 'Failed to upload file',
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}, { maxConcurrent: 10 });
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Deletes multiple files with smart concurrency control.
|
|
59
|
-
* Returns detailed results so you know exactly what happened with each file.
|
|
60
|
-
*/
|
|
61
|
-
async deleteMultiple(fileNames) {
|
|
62
|
-
if (!fileNames || fileNames.length === 0) {
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
return withConcurrencyLimit(fileNames, async (fileName) => {
|
|
66
|
-
try {
|
|
67
|
-
const success = await this.delete(fileName);
|
|
68
|
-
const result = { success, fileName };
|
|
69
|
-
if (!success) {
|
|
70
|
-
result.error = 'File not found or already deleted';
|
|
71
|
-
}
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
return {
|
|
76
|
-
success: false,
|
|
77
|
-
fileName,
|
|
78
|
-
error: error instanceof Error ? error.message : 'Failed to delete file',
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}, { maxConcurrent: 10 });
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Creates a unique filename that won't collide with existing files.
|
|
85
|
-
* Format: {timestamp}_{random}_{original_name}.{ext}
|
|
86
|
-
*/
|
|
87
|
-
generateFileName(originalName) {
|
|
88
|
-
return generateUniqueFileName(originalName);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Builds a success response for upload operations.
|
|
92
|
-
*/
|
|
93
|
-
createSuccessResult(fileName, fileUrl) {
|
|
94
|
-
const result = {
|
|
95
|
-
success: true,
|
|
96
|
-
fileName,
|
|
97
|
-
};
|
|
98
|
-
if (fileUrl) {
|
|
99
|
-
result.fileUrl = fileUrl;
|
|
100
|
-
}
|
|
101
|
-
return result;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Builds an error response for upload operations.
|
|
105
|
-
*/
|
|
106
|
-
createErrorResult(error) {
|
|
107
|
-
return {
|
|
108
|
-
success: false,
|
|
109
|
-
error,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Builds a success response for presigned URL operations.
|
|
114
|
-
*/
|
|
115
|
-
createPresignedSuccessResult(uploadUrl, viewUrl) {
|
|
116
|
-
const result = {
|
|
117
|
-
success: true,
|
|
118
|
-
};
|
|
119
|
-
if (uploadUrl) {
|
|
120
|
-
result.uploadUrl = uploadUrl;
|
|
121
|
-
}
|
|
122
|
-
if (viewUrl) {
|
|
123
|
-
result.viewUrl = viewUrl;
|
|
124
|
-
}
|
|
125
|
-
return result;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Builds an error response for presigned URL operations.
|
|
129
|
-
*/
|
|
130
|
-
createPresignedErrorResult(error) {
|
|
131
|
-
return {
|
|
132
|
-
success: false,
|
|
133
|
-
error,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Validates a file before upload.
|
|
138
|
-
*
|
|
139
|
-
* Checks for common issues:
|
|
140
|
-
* - Missing file
|
|
141
|
-
* - No original name
|
|
142
|
-
* - No MIME type
|
|
143
|
-
* - Empty content
|
|
144
|
-
*
|
|
145
|
-
* Works with both Multer memory storage (file.buffer) and disk storage (file.path).
|
|
146
|
-
*/
|
|
147
|
-
validateFile(file) {
|
|
148
|
-
const errors = [];
|
|
149
|
-
if (!file) {
|
|
150
|
-
errors.push('No file provided');
|
|
151
|
-
return errors;
|
|
152
|
-
}
|
|
153
|
-
if (!file.originalname) {
|
|
154
|
-
errors.push('File must have an original name');
|
|
155
|
-
}
|
|
156
|
-
if (!file.mimetype) {
|
|
157
|
-
errors.push('File must have a MIME type');
|
|
158
|
-
}
|
|
159
|
-
// Check for file content (could be in memory or on disk)
|
|
160
|
-
const hasBuffer = (file.buffer?.length ?? 0) > 0;
|
|
161
|
-
const hasPath = typeof file.path === 'string' && file.path.length > 0;
|
|
162
|
-
const hasEmptyBuffer = file.buffer !== null && file.buffer !== undefined && file.buffer.length === 0;
|
|
163
|
-
if (hasEmptyBuffer && !hasPath) {
|
|
164
|
-
errors.push('File is empty (0 bytes)');
|
|
165
|
-
}
|
|
166
|
-
else if (!hasBuffer && !hasPath) {
|
|
167
|
-
errors.push('File must have either buffer (memory storage) or path (disk storage)');
|
|
168
|
-
}
|
|
169
|
-
// For disk storage, verify the file exists and isn't empty
|
|
170
|
-
if (hasPath && !hasBuffer) {
|
|
171
|
-
try {
|
|
172
|
-
const stats = fs.statSync(file.path);
|
|
173
|
-
if (stats.size === 0) {
|
|
174
|
-
errors.push('File is empty (0 bytes)');
|
|
175
|
-
}
|
|
176
|
-
if (!file.size || file.size === 0) {
|
|
177
|
-
file.size = stats.size;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
catch {
|
|
181
|
-
errors.push('Cannot read file from disk storage path');
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return errors;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Reads the file content, whether it's in memory or on disk.
|
|
188
|
-
*
|
|
189
|
-
* Note: For disk storage, this reads the file but doesn't delete it.
|
|
190
|
-
* Call cleanupTempFile() afterward if you need to remove the temp file.
|
|
191
|
-
*
|
|
192
|
-
* @warning **MEMORY IMPLICATIONS**: This method loads the ENTIRE file into memory.
|
|
193
|
-
* For large files, this can cause memory exhaustion and application crashes.
|
|
194
|
-
*
|
|
195
|
-
* **ALWAYS call `shouldUseStreaming(file)` first** and use `getFileStream()`
|
|
196
|
-
* for files larger than 100MB. Example:
|
|
197
|
-
*
|
|
198
|
-
* ```typescript
|
|
199
|
-
* if (this.shouldUseStreaming(file)) {
|
|
200
|
-
* return this.uploadWithStream(file);
|
|
201
|
-
* }
|
|
202
|
-
* const content = this.getFileContent(file); // Safe for smaller files
|
|
203
|
-
* ```
|
|
204
|
-
*
|
|
205
|
-
* Memory usage: A 1GB file will allocate ~1GB of heap memory.
|
|
206
|
-
* Node.js default heap limit is ~1.5GB, so large files WILL crash your app.
|
|
207
|
-
*
|
|
208
|
-
* @param file - The Multer file object
|
|
209
|
-
* @returns Buffer containing the entire file contents
|
|
210
|
-
* @throws Error if file has neither buffer nor path
|
|
211
|
-
*/
|
|
212
|
-
getFileContent(file) {
|
|
213
|
-
if ((file.buffer?.length ?? 0) > 0) {
|
|
214
|
-
return file.buffer;
|
|
215
|
-
}
|
|
216
|
-
if (file.path) {
|
|
217
|
-
return fs.readFileSync(file.path);
|
|
218
|
-
}
|
|
219
|
-
throw new Error('File has neither buffer nor path - cannot read content');
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Returns a readable stream for the file content.
|
|
223
|
-
*
|
|
224
|
-
* Use this instead of getFileContent() for large files to avoid
|
|
225
|
-
* loading the entire file into memory. Particularly useful for
|
|
226
|
-
* files larger than 100MB.
|
|
227
|
-
*
|
|
228
|
-
* @param file - The Multer file object
|
|
229
|
-
* @returns A readable stream of the file content
|
|
230
|
-
*/
|
|
231
|
-
getFileStream(file) {
|
|
232
|
-
if ((file.buffer?.length ?? 0) > 0) {
|
|
233
|
-
return Readable.from(file.buffer);
|
|
234
|
-
}
|
|
235
|
-
if (file.path) {
|
|
236
|
-
return fs.createReadStream(file.path);
|
|
237
|
-
}
|
|
238
|
-
throw new Error('File has neither buffer nor path - cannot create stream');
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Determines if a file should use streaming based on its size.
|
|
242
|
-
*
|
|
243
|
-
* Files larger than 100MB benefit from streaming to reduce memory usage.
|
|
244
|
-
*
|
|
245
|
-
* @param file - The Multer file object
|
|
246
|
-
* @returns true if the file should use streaming
|
|
247
|
-
*/
|
|
248
|
-
shouldUseStreaming(file) {
|
|
249
|
-
const size = file.size || 0;
|
|
250
|
-
return size > STREAM_THRESHOLD;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Gets the file size, reading from disk if necessary.
|
|
254
|
-
*
|
|
255
|
-
* @param file - The Multer file object
|
|
256
|
-
* @returns The file size in bytes
|
|
257
|
-
*/
|
|
258
|
-
getFileSize(file) {
|
|
259
|
-
if (file.size && file.size > 0) {
|
|
260
|
-
return file.size;
|
|
261
|
-
}
|
|
262
|
-
if (file.buffer?.length) {
|
|
263
|
-
return file.buffer.length;
|
|
264
|
-
}
|
|
265
|
-
if (file.path) {
|
|
266
|
-
try {
|
|
267
|
-
const stats = fs.statSync(file.path);
|
|
268
|
-
return stats.size;
|
|
269
|
-
}
|
|
270
|
-
catch {
|
|
271
|
-
return 0;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return 0;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Removes a temporary file created by Multer disk storage.
|
|
278
|
-
*
|
|
279
|
-
* Call this after a successful upload if you're using disk storage
|
|
280
|
-
* and want to clean up. Memory storage doesn't need this — the
|
|
281
|
-
* garbage collector handles cleanup automatically.
|
|
282
|
-
*
|
|
283
|
-
* @returns true if the file was deleted, false otherwise
|
|
284
|
-
*/
|
|
285
|
-
cleanupTempFile(file) {
|
|
286
|
-
if (file.path && fs.existsSync(file.path)) {
|
|
287
|
-
try {
|
|
288
|
-
fs.unlinkSync(file.path);
|
|
289
|
-
return true;
|
|
290
|
-
}
|
|
291
|
-
catch {
|
|
292
|
-
return false;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return false;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Returns how long presigned URLs should be valid (in seconds).
|
|
299
|
-
*
|
|
300
|
-
* Clamps the value to stay within cloud provider limits:
|
|
301
|
-
* - Minimum: 1 second
|
|
302
|
-
* - Maximum: 7 days (604800 seconds)
|
|
303
|
-
* - Default: 10 minutes (600 seconds)
|
|
304
|
-
*/
|
|
305
|
-
getPresignedUrlExpiry() {
|
|
306
|
-
const MAX_EXPIRY = 604800;
|
|
307
|
-
const MIN_EXPIRY = 1;
|
|
308
|
-
const DEFAULT_EXPIRY = 600;
|
|
309
|
-
const expiry = this.config.presignedUrlExpiry;
|
|
310
|
-
if (expiry === undefined || expiry === null || Number.isNaN(expiry)) {
|
|
311
|
-
return DEFAULT_EXPIRY;
|
|
312
|
-
}
|
|
313
|
-
if (expiry < MIN_EXPIRY) {
|
|
314
|
-
return MIN_EXPIRY;
|
|
315
|
-
}
|
|
316
|
-
if (expiry > MAX_EXPIRY) {
|
|
317
|
-
return MAX_EXPIRY;
|
|
318
|
-
}
|
|
319
|
-
return expiry;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Confirms that an upload completed successfully.
|
|
323
|
-
*
|
|
324
|
-
* The default implementation just checks if the file exists.
|
|
325
|
-
* Azure overrides this to validate file properties since Azure
|
|
326
|
-
* doesn't enforce constraints at the presigned URL level.
|
|
327
|
-
*/
|
|
328
|
-
async validateAndConfirmUpload(reference, _options) {
|
|
329
|
-
const viewResult = await this.generateViewUrl(reference);
|
|
330
|
-
if (viewResult.success) {
|
|
331
|
-
const result = {
|
|
332
|
-
success: true,
|
|
333
|
-
reference,
|
|
334
|
-
expiresIn: this.getPresignedUrlExpiry(),
|
|
335
|
-
};
|
|
336
|
-
if (viewResult.viewUrl) {
|
|
337
|
-
result.viewUrl = viewResult.viewUrl;
|
|
338
|
-
}
|
|
339
|
-
return result;
|
|
340
|
-
}
|
|
341
|
-
return {
|
|
342
|
-
success: false,
|
|
343
|
-
error: viewResult.error || 'File not found',
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
//# sourceMappingURL=base.driver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.driver.js","sourceRoot":"","sources":["../../src/drivers/base.driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEtF,oDAAoD;AACpD,MAAM,gBAAgB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C;;;;;;;;GAQG;AACH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