@nuvix/storage 1.0.0 → 2.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/dist/index.cjs.js DELETED
@@ -1,1296 +0,0 @@
1
- 'use strict';
2
-
3
- var promises = require('fs/promises');
4
- var fs = require('fs');
5
- var path = require('path');
6
- var crypto = require('crypto');
7
-
8
- class Device {
9
- constructor() {
10
- /**
11
- * Max chunk size while transferring file from one device to another
12
- */
13
- this.transferChunkSize = 20000000; // 20 MB
14
- }
15
- /**
16
- * Set Transfer Chunk Size
17
- */
18
- setTransferChunkSize(chunkSize) {
19
- this.transferChunkSize = chunkSize;
20
- }
21
- /**
22
- * Get Transfer Chunk Size
23
- */
24
- getTransferChunkSize() {
25
- return this.transferChunkSize;
26
- }
27
- /**
28
- * Move file from given source to given path, return true on success and false on failure.
29
- */
30
- async move(source, target) {
31
- if (source === target) {
32
- return false;
33
- }
34
- if (await this.transfer(source, target, this)) {
35
- return await this.delete(source);
36
- }
37
- return false;
38
- }
39
- /**
40
- * Get the absolute path by resolving strings like ../, .., //, /\ and so on.
41
- *
42
- * Works like the realpath function but works on files that does not exist
43
- */
44
- getAbsolutePath(path) {
45
- const normalizedPath = path.replace(/[/\\]/g, "/");
46
- const parts = normalizedPath.split("/").filter((part) => part.length > 0);
47
- const absolutes = [];
48
- for (const part of parts) {
49
- if (part === ".") {
50
- continue;
51
- }
52
- if (part === "..") {
53
- absolutes.pop();
54
- }
55
- else {
56
- absolutes.push(part);
57
- }
58
- }
59
- return "/" + absolutes.join("/");
60
- }
61
- async getMimeType(filePath) {
62
- const path = await import('path');
63
- // Node.js doesn't have a built-in MIME type module, so we'll use a comprehensive mapping
64
- const ext = path.extname(filePath).toLowerCase().slice(1);
65
- const mimeTypes = {
66
- // Text
67
- txt: "text/plain",
68
- html: "text/html",
69
- htm: "text/html",
70
- css: "text/css",
71
- csv: "text/csv",
72
- xml: "text/xml",
73
- // JavaScript
74
- js: "application/javascript",
75
- mjs: "application/javascript",
76
- json: "application/json",
77
- // Images
78
- png: "image/png",
79
- jpg: "image/jpeg",
80
- jpeg: "image/jpeg",
81
- gif: "image/gif",
82
- svg: "image/svg+xml",
83
- webp: "image/webp",
84
- ico: "image/x-icon",
85
- bmp: "image/bmp",
86
- tiff: "image/tiff",
87
- tif: "image/tiff",
88
- // Documents
89
- pdf: "application/pdf",
90
- doc: "application/msword",
91
- docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
92
- xls: "application/vnd.ms-excel",
93
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
94
- ppt: "application/vnd.ms-powerpoint",
95
- pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
96
- // Audio
97
- mp3: "audio/mpeg",
98
- wav: "audio/wav",
99
- ogg: "audio/ogg",
100
- m4a: "audio/mp4",
101
- // Video
102
- mp4: "video/mp4",
103
- avi: "video/x-msvideo",
104
- mov: "video/quicktime",
105
- wmv: "video/x-ms-wmv",
106
- flv: "video/x-flv",
107
- webm: "video/webm",
108
- // Archives
109
- zip: "application/zip",
110
- rar: "application/x-rar-compressed",
111
- tar: "application/x-tar",
112
- gz: "application/gzip",
113
- "7z": "application/x-7z-compressed",
114
- // Other
115
- bin: "application/octet-stream",
116
- exe: "application/octet-stream",
117
- dmg: "application/octet-stream",
118
- };
119
- return mimeTypes[ext] || "application/octet-stream";
120
- }
121
- }
122
- /**
123
- * Sets the maximum number of keys returned to the response. By default, the action returns up to 1,000 key names.
124
- */
125
- Device.MAX_PAGE_SIZE = Number.MAX_SAFE_INTEGER;
126
-
127
- class Storage {
128
- /**
129
- * Set Device.
130
- *
131
- * Add device by name
132
- *
133
- * @param name
134
- * @param device
135
- * @throws Error
136
- */
137
- static setDevice(name, device) {
138
- this.devices.set(name, device);
139
- }
140
- /**
141
- * Get Device.
142
- *
143
- * Get device by name
144
- *
145
- * @param name
146
- * @returns Device
147
- * @throws Error
148
- */
149
- static getDevice(name) {
150
- if (!this.devices.has(name)) {
151
- throw new Error(`The device "${name}" is not listed`);
152
- }
153
- return this.devices.get(name);
154
- }
155
- /**
156
- * Exists.
157
- *
158
- * Checks if given storage name is registered or not
159
- *
160
- * @param name
161
- * @returns boolean
162
- */
163
- static exists(name) {
164
- return this.devices.has(name);
165
- }
166
- /**
167
- * Human readable data size format from bytes input.
168
- *
169
- * Based on: https://stackoverflow.com/a/38659168/2299554
170
- *
171
- * @param bytes
172
- * @param decimals
173
- * @param system
174
- * @returns string
175
- */
176
- static human(bytes, decimals = 2, system = "metric") {
177
- const mod = system === "binary" ? 1024 : 1000;
178
- const units = {
179
- binary: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"],
180
- metric: ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
181
- };
182
- const factor = Math.floor((bytes.toString().length - 1) / 3);
183
- return `${(bytes / Math.pow(mod, factor)).toFixed(decimals)}${units[system][factor]}`;
184
- }
185
- }
186
- /**
187
- * Supported devices
188
- */
189
- Storage.DEVICE_LOCAL = "local";
190
- Storage.DEVICE_S3 = "s3";
191
- // static readonly DEVICE_DO_SPACES = 'dospaces';
192
- Storage.DEVICE_WASABI = "wasabi";
193
- Storage.DEVICE_MINIO = "minio";
194
- // static readonly DEVICE_BACKBLAZE = 'backblaze';
195
- // static readonly DEVICE_LINODE = 'linode';
196
- /**
197
- * Devices.
198
- *
199
- * List of all available storage devices
200
- */
201
- Storage.devices = new Map();
202
-
203
- class Validator {
204
- }
205
- Validator.TYPE_STRING = "string";
206
- Validator.TYPE_ARRAY = "array";
207
- Validator.TYPE_INTEGER = "integer";
208
- Validator.TYPE_BOOLEAN = "boolean";
209
-
210
- class File extends Validator {
211
- getDescription() {
212
- return "File is not valid";
213
- }
214
- /**
215
- * NOT MUCH RIGHT NOW.
216
- *
217
- * TODO think what to do here, currently only used for parameter to be present in SDKs
218
- *
219
- * @param name
220
- * @return boolean
221
- */
222
- isValid(name) {
223
- return true;
224
- }
225
- }
226
-
227
- class FileExt extends Validator {
228
- constructor(allowed) {
229
- super();
230
- this.allowed = allowed;
231
- }
232
- getDescription() {
233
- return "File extension is not valid";
234
- }
235
- isValid(filename) {
236
- const ext = this.getFileExtension(filename).toLowerCase();
237
- return this.allowed.includes(ext);
238
- }
239
- getFileExtension(filename) {
240
- const lastDotIndex = filename.lastIndexOf(".");
241
- return lastDotIndex !== -1 ? filename.substring(lastDotIndex + 1) : "";
242
- }
243
- }
244
- FileExt.TYPE_JPEG = "jpeg";
245
- FileExt.TYPE_JPG = "jpg";
246
- FileExt.TYPE_GIF = "gif";
247
- FileExt.TYPE_PNG = "png";
248
- FileExt.TYPE_GZIP = "gz";
249
- FileExt.TYPE_ZIP = "zip";
250
-
251
- class FileName extends Validator {
252
- /**
253
- * Get Description
254
- */
255
- getDescription() {
256
- return "Filename is not valid";
257
- }
258
- /**
259
- * The file name can only contain "a-z", "A-Z", "0-9" and "." and not empty.
260
- *
261
- * @param name - The filename to validate
262
- * @returns boolean indicating if the filename is valid
263
- */
264
- isValid(name) {
265
- if (!name) {
266
- return false;
267
- }
268
- if (typeof name !== "string") {
269
- return false;
270
- }
271
- if (!/^[a-zA-Z0-9.]+$/.test(name)) {
272
- return false;
273
- }
274
- return true;
275
- }
276
- }
277
-
278
- class FileSize extends Validator {
279
- /**
280
- * Max size in bytes
281
- */
282
- constructor(max) {
283
- super();
284
- this.max = max;
285
- }
286
- /**
287
- * Get Description
288
- */
289
- getDescription() {
290
- return `File size can't be bigger than ${this.max}`;
291
- }
292
- /**
293
- * Finds whether a file size is smaller than required limit.
294
- */
295
- isValid(fileSize) {
296
- if (typeof fileSize !== "number" || !Number.isInteger(fileSize)) {
297
- return false;
298
- }
299
- if (fileSize > this.max || fileSize < 0) {
300
- return false;
301
- }
302
- return true;
303
- }
304
- }
305
-
306
- class FileType extends Validator {
307
- constructor(allowed) {
308
- super();
309
- /**
310
- * File Type Binaries.
311
- */
312
- this.types = {
313
- [FileType.FILE_TYPE_JPEG]: "\xFF\xD8\xFF",
314
- [FileType.FILE_TYPE_GIF]: "GIF",
315
- [FileType.FILE_TYPE_PNG]: "\x89\x50\x4e\x47\x0d\x0a",
316
- [FileType.FILE_TYPE_GZIP]: "application/x-gzip",
317
- };
318
- for (const key of allowed) {
319
- if (!(key in this.types)) {
320
- throw new Error("Unknown file mime type");
321
- }
322
- }
323
- this.allowed = allowed;
324
- }
325
- /**
326
- * Get Description
327
- */
328
- getDescription() {
329
- return "File mime-type is not allowed ";
330
- }
331
- /**
332
- * Is Valid.
333
- *
334
- * Binary check to finds whether a file is of valid type
335
- */
336
- async isValid(path) {
337
- try {
338
- const buffer = await promises.readFile(path);
339
- // Calculate the maximum signature length needed
340
- const maxSignatureLength = Math.max(...Object.values(this.types).map((sig) => sig.length));
341
- const bytesToRead = Math.min(buffer.length, Math.max(8, maxSignatureLength));
342
- const bytes = buffer.toString("binary", 0, bytesToRead);
343
- for (const key of this.allowed) {
344
- if (bytes.indexOf(this.types[key]) === 0) {
345
- return true;
346
- }
347
- }
348
- return false;
349
- }
350
- catch {
351
- return false;
352
- }
353
- }
354
- }
355
- /**
356
- * File Types Constants.
357
- */
358
- FileType.FILE_TYPE_JPEG = "jpeg";
359
- FileType.FILE_TYPE_GIF = "gif";
360
- FileType.FILE_TYPE_PNG = "png";
361
- FileType.FILE_TYPE_GZIP = "gz";
362
-
363
- class Upload extends Validator {
364
- /**
365
- * Get Description
366
- */
367
- getDescription() {
368
- return "Not a valid upload file";
369
- }
370
- /**
371
- * Check if a file is a valid upload file
372
- *
373
- * @param path - The file path to validate
374
- * @returns Promise that resolves to true if valid upload file, false otherwise
375
- */
376
- async isValid(path) {
377
- if (typeof path !== "string") {
378
- return false;
379
- }
380
- try {
381
- const stats = await fs.promises.stat(path);
382
- return stats.isFile();
383
- }
384
- catch {
385
- return false;
386
- }
387
- }
388
- }
389
-
390
- class Local extends Device {
391
- constructor(root = "") {
392
- super();
393
- this.root = "temp";
394
- this.MAX_PAGE_SIZE = 1000;
395
- this.root = root;
396
- }
397
- getName() {
398
- return "Local Storage";
399
- }
400
- getType() {
401
- return Storage.DEVICE_LOCAL;
402
- }
403
- getDescription() {
404
- return "Adapter for Local storage that is in the physical or virtual machine or mounted to it.";
405
- }
406
- getRoot() {
407
- return this.root;
408
- }
409
- getPath(filename, prefix) {
410
- return this.getAbsolutePath(path.join(this.getRoot(), filename));
411
- }
412
- async upload(source, filePath, chunk = 1, chunks = 1, metadata = {}) {
413
- await this.createDirectory(path.dirname(filePath));
414
- if (chunks === 1) {
415
- try {
416
- await fs.promises.rename(source, filePath);
417
- return chunks;
418
- }
419
- catch {
420
- throw new Error(`Can't upload file ${filePath}`);
421
- }
422
- }
423
- const tmp = path.join(path.dirname(filePath), `tmp_${path.basename(filePath)}`, `${path.basename(filePath)}_chunks.log`);
424
- await this.createDirectory(path.dirname(tmp));
425
- const chunkFilePath = path.join(path.dirname(tmp), `${path.parse(filePath).name}.part.${chunk}`);
426
- if (!(await this.exists(chunkFilePath))) {
427
- try {
428
- await fs.promises.appendFile(tmp, `${chunk}\n`);
429
- }
430
- catch {
431
- throw new Error(`Can't write chunk log ${tmp}`);
432
- }
433
- }
434
- try {
435
- const chunkLogs = await fs.promises.readFile(tmp, "utf8");
436
- const chunksReceived = chunkLogs.trim().split("\n").length;
437
- await fs.promises.rename(source, chunkFilePath);
438
- if (chunks === chunksReceived) {
439
- await this.joinChunks(filePath, chunks);
440
- return chunksReceived;
441
- }
442
- return chunksReceived;
443
- }
444
- catch {
445
- throw new Error(`Failed to write chunk ${chunk}`);
446
- }
447
- }
448
- async uploadData(data, filePath, contentType, chunk = 1, chunks = 1, metadata = {}) {
449
- await this.createDirectory(path.dirname(filePath));
450
- if (chunks === 1) {
451
- try {
452
- await fs.promises.writeFile(filePath, data);
453
- return chunks;
454
- }
455
- catch {
456
- throw new Error(`Can't write file ${filePath}`);
457
- }
458
- }
459
- const tmp = path.join(path.dirname(filePath), `tmp_${path.basename(filePath)}`, `${path.basename(filePath)}_chunks.log`);
460
- await this.createDirectory(path.dirname(tmp));
461
- try {
462
- await fs.promises.appendFile(tmp, `${chunk}\n`);
463
- const chunkLogs = await fs.promises.readFile(tmp, "utf8");
464
- const chunksReceived = chunkLogs.trim().split("\n").length;
465
- const chunkFilePath = path.join(path.dirname(tmp), `${path.parse(filePath).name}.part.${chunk}`);
466
- await fs.promises.writeFile(chunkFilePath, data);
467
- if (chunks === chunksReceived) {
468
- await this.joinChunks(filePath, chunks);
469
- return chunksReceived;
470
- }
471
- return chunksReceived;
472
- }
473
- catch {
474
- throw new Error(`Failed to write chunk ${chunk}`);
475
- }
476
- }
477
- async joinChunks(filePath, chunks) {
478
- const tmp = path.join(path.dirname(filePath), `tmp_${path.basename(filePath)}`, `${path.basename(filePath)}_chunks.log`);
479
- for (let i = 1; i <= chunks; i++) {
480
- const part = path.join(path.dirname(tmp), `${path.parse(filePath).name}.part.${i}`);
481
- try {
482
- const data = await fs.promises.readFile(part);
483
- await fs.promises.appendFile(filePath, data);
484
- await fs.promises.unlink(part);
485
- }
486
- catch {
487
- throw new Error(`Failed to read/append chunk ${part}`);
488
- }
489
- }
490
- await fs.promises.unlink(tmp);
491
- await fs.promises.rmdir(path.dirname(tmp));
492
- }
493
- async transfer(filePath, destination, device) {
494
- if (!(await this.exists(filePath))) {
495
- throw new Error("File Not Found");
496
- }
497
- const size = await this.getFileSize(filePath);
498
- const contentType = await this.getFileMimeType(filePath);
499
- if (size <= this.transferChunkSize) {
500
- const source = await this.read(filePath);
501
- return await device.write(destination, source, contentType);
502
- }
503
- const totalChunks = Math.ceil(size / this.transferChunkSize);
504
- const metadata = { content_type: contentType };
505
- for (let counter = 0; counter < totalChunks; counter++) {
506
- const start = counter * this.transferChunkSize;
507
- const data = await this.read(filePath, start, this.transferChunkSize);
508
- await device.uploadData(data, destination, contentType, counter + 1, totalChunks, metadata);
509
- }
510
- return true;
511
- }
512
- async abort(filePath, extra = "") {
513
- if (await this.exists(filePath)) {
514
- await fs.promises.unlink(filePath);
515
- }
516
- const tmp = path.join(path.dirname(filePath), `tmp_${path.basename(filePath)}`);
517
- if (!(await this.exists(path.dirname(tmp)))) {
518
- throw new Error(`File doesn't exist: ${path.dirname(filePath)}`);
519
- }
520
- const files = await this.getFiles(tmp);
521
- for (const file of files) {
522
- await this.delete(file, true);
523
- }
524
- return fs.promises
525
- .rmdir(tmp)
526
- .then(() => true)
527
- .catch(() => false);
528
- }
529
- async read(filePath, offset = 0, length) {
530
- if (!(await this.exists(filePath))) {
531
- throw new Error("File Not Found");
532
- }
533
- const fileHandle = await fs.promises.open(filePath, "r");
534
- try {
535
- const size = length ?? (await fileHandle.stat()).size - offset;
536
- const buffer = Buffer.alloc(size);
537
- await fileHandle.read(buffer, 0, size, offset);
538
- return buffer;
539
- }
540
- finally {
541
- await fileHandle.close();
542
- }
543
- }
544
- async write(filePath, data, contentType = "") {
545
- try {
546
- await this.createDirectory(path.dirname(filePath));
547
- await fs.promises.writeFile(filePath, data);
548
- return true;
549
- }
550
- catch {
551
- throw new Error(`Can't write to path ${filePath}`);
552
- }
553
- }
554
- async move(source, target) {
555
- if (source === target) {
556
- return false;
557
- }
558
- try {
559
- await this.createDirectory(path.dirname(target));
560
- await fs.promises.rename(source, target);
561
- return true;
562
- }
563
- catch {
564
- return false;
565
- }
566
- }
567
- async delete(filePath, recursive = false) {
568
- try {
569
- const stats = await fs.promises.stat(filePath);
570
- if (stats.isDirectory() && recursive) {
571
- const files = await this.getFiles(filePath);
572
- for (const file of files) {
573
- await this.delete(file, true);
574
- }
575
- await fs.promises.rmdir(filePath);
576
- }
577
- else if (stats.isFile() || stats.isSymbolicLink()) {
578
- await fs.promises.unlink(filePath);
579
- }
580
- return true;
581
- }
582
- catch {
583
- return false;
584
- }
585
- }
586
- async deletePath(filePath) {
587
- const fullPath = path.resolve(path.join(this.getRoot(), filePath));
588
- try {
589
- if (!(await this.exists(fullPath))) {
590
- return false;
591
- }
592
- const stats = await fs.promises.stat(fullPath);
593
- if (!stats.isDirectory()) {
594
- return false;
595
- }
596
- const files = await this.getFiles(fullPath);
597
- for (const file of files) {
598
- const stats = await fs.promises.stat(file);
599
- if (stats.isDirectory()) {
600
- const relativePath = file.replace(this.getRoot() + path.sep, "");
601
- await this.deletePath(relativePath);
602
- }
603
- else {
604
- await this.delete(file, true);
605
- }
606
- }
607
- await fs.promises.rmdir(fullPath);
608
- return true;
609
- }
610
- catch {
611
- return false;
612
- }
613
- }
614
- async exists(filePath) {
615
- try {
616
- await fs.promises.access(filePath);
617
- return true;
618
- }
619
- catch {
620
- return false;
621
- }
622
- }
623
- async getFileSize(filePath) {
624
- const stats = await fs.promises.stat(filePath);
625
- return stats.size;
626
- }
627
- async getFileMimeType(filePath) {
628
- return this.getMimeType(filePath);
629
- }
630
- async getFileHash(filePath) {
631
- const data = await fs.promises.readFile(filePath);
632
- return crypto.createHash("md5").update(data).digest("hex");
633
- }
634
- async createDirectory(dirPath) {
635
- try {
636
- await fs.promises.mkdir(dirPath, { recursive: true, mode: 0o755 });
637
- return true;
638
- }
639
- catch {
640
- return false;
641
- }
642
- }
643
- async getDirectorySize(dirPath) {
644
- try {
645
- let size = 0;
646
- const files = await fs.promises.readdir(dirPath, { withFileTypes: true });
647
- for (const file of files) {
648
- if (file.name.startsWith("."))
649
- continue;
650
- const fullPath = path.join(dirPath, file.name);
651
- if (file.isDirectory()) {
652
- size += await this.getDirectorySize(fullPath);
653
- }
654
- else {
655
- const stats = await fs.promises.stat(fullPath);
656
- size += stats.size;
657
- }
658
- }
659
- return size;
660
- }
661
- catch {
662
- return -1;
663
- }
664
- }
665
- async getPartitionFreeSpace() {
666
- const stats = await fs.promises.statfs(this.getRoot());
667
- return stats.bavail * stats.bsize;
668
- }
669
- async getPartitionTotalSpace() {
670
- const stats = await fs.promises.statfs(this.getRoot());
671
- return stats.blocks * stats.bsize;
672
- }
673
- async getFiles(dir, max = this.MAX_PAGE_SIZE, continuationToken = "") {
674
- try {
675
- const entries = await fs.promises.readdir(dir, { withFileTypes: true });
676
- return entries.map((entry) => path.join(dir, entry.name));
677
- }
678
- catch {
679
- return [];
680
- }
681
- }
682
- }
683
-
684
- class S3 extends Device {
685
- constructor(root, accessKey, secretKey, bucket, region = S3.US_EAST_1, acl = S3.ACL_PRIVATE, endpointUrl = "") {
686
- super();
687
- this.acl = S3.ACL_PRIVATE;
688
- this.root = "temp";
689
- this.headers = {
690
- host: "",
691
- date: "",
692
- "content-md5": "",
693
- "content-type": "",
694
- };
695
- this.accessKey = accessKey;
696
- this.secretKey = secretKey;
697
- this.bucket = bucket;
698
- this.region = region;
699
- this.root = root;
700
- this.acl = acl;
701
- this.amzHeaders = {};
702
- let host;
703
- if (endpointUrl) {
704
- host = `${bucket}.${endpointUrl}`;
705
- }
706
- else {
707
- switch (region) {
708
- case S3.CN_NORTH_1:
709
- case S3.CN_NORTH_4:
710
- case S3.CN_NORTHWEST_1:
711
- host = `${bucket}.s3.${region}.amazonaws.cn`;
712
- break;
713
- default:
714
- host = `${bucket}.s3.${region}.amazonaws.com`;
715
- }
716
- }
717
- this.headers["host"] = host;
718
- }
719
- getName() {
720
- return "S3 Storage";
721
- }
722
- getType() {
723
- return Storage.DEVICE_S3;
724
- }
725
- getDescription() {
726
- return "S3 Bucket Storage drive for AWS or on premise solution";
727
- }
728
- getRoot() {
729
- return this.root;
730
- }
731
- getPath(filename, prefix) {
732
- return `${this.getRoot()}/${filename}`;
733
- }
734
- getPartitionTotalSpace() {
735
- throw new Error("Method not implemented.");
736
- }
737
- static setRetryAttempts(attempts) {
738
- S3.retryAttempts = attempts;
739
- }
740
- static setRetryDelay(delay) {
741
- S3.retryDelay = delay;
742
- }
743
- async upload(source, path, chunk = 1, chunks = 1, metadata = {}) {
744
- let data;
745
- let contentType;
746
- if (typeof source === "string") {
747
- const fs = await import('fs');
748
- data = await fs.promises.readFile(source);
749
- contentType = await this.getMimeType(source);
750
- }
751
- else {
752
- data = source;
753
- contentType = metadata.contentType || "application/octet-stream";
754
- }
755
- return this.uploadData(data, path, contentType, chunk, chunks, metadata);
756
- }
757
- async uploadData(data, path, contentType, chunk = 1, chunks = 1, metadata = {}) {
758
- if (chunk === 1 && chunks === 1) {
759
- await this.write(path, data, contentType);
760
- return 1;
761
- }
762
- let uploadId = metadata["uploadId"];
763
- if (!uploadId) {
764
- uploadId = await this.createMultipartUpload(path, contentType);
765
- metadata["uploadId"] = uploadId;
766
- }
767
- metadata["parts"] = metadata["parts"] || {};
768
- metadata["chunks"] = metadata["chunks"] || 0;
769
- const etag = await this.uploadPart(data, path, contentType, chunk, uploadId);
770
- const cleanETag = etag.replace(/^"|"$/g, "");
771
- if (!(chunk in metadata["parts"])) {
772
- metadata["chunks"]++;
773
- }
774
- metadata["parts"][chunk] = cleanETag;
775
- if (metadata["chunks"] === chunks) {
776
- await this.completeMultipartUpload(path, uploadId, metadata["parts"]);
777
- }
778
- return metadata["chunks"];
779
- }
780
- async transfer(path, destination, device) {
781
- try {
782
- const response = await this.getInfo(path);
783
- const size = parseInt(response["content-length"] || "0");
784
- const contentType = response["content-type"] || "";
785
- if (size <= this.transferChunkSize) {
786
- const source = await this.read(path);
787
- return device.write(destination, source, contentType);
788
- }
789
- const totalChunks = Math.ceil(size / this.transferChunkSize);
790
- const metadata = { content_type: contentType };
791
- for (let counter = 0; counter < totalChunks; counter++) {
792
- const start = counter * this.transferChunkSize;
793
- const data = await this.read(path, start, this.transferChunkSize);
794
- await device.uploadData(data, destination, contentType, counter + 1, totalChunks, metadata);
795
- }
796
- return true;
797
- }
798
- catch (e) {
799
- throw new Error("File not found");
800
- }
801
- }
802
- async createMultipartUpload(path, contentType) {
803
- const uri = path !== ""
804
- ? `/${encodeURIComponent(path).replace(/%2F/g, "/").replace(/%3F/g, "?")}`
805
- : "/";
806
- this.headers["content-md5"] = Buffer.from(this.md5("")).toString("base64");
807
- delete this.amzHeaders["x-amz-content-sha256"];
808
- this.headers["content-type"] = contentType;
809
- this.amzHeaders["x-amz-acl"] = this.acl;
810
- const response = await this.call(S3.METHOD_POST, uri, "", { uploads: "" });
811
- const uploadId = response.body?.InitiateMultipartUploadResult?.UploadId?.[0];
812
- return uploadId;
813
- }
814
- async uploadPart(data, path, contentType, chunk, uploadId) {
815
- const uri = path !== ""
816
- ? `/${encodeURIComponent(path).replace(/%2F/g, "/").replace(/%3F/g, "?")}`
817
- : "/";
818
- this.headers["content-type"] = contentType;
819
- this.headers["content-md5"] = Buffer.from(this.md5(data)).toString("base64");
820
- this.amzHeaders["x-amz-content-sha256"] = this.sha256(data);
821
- delete this.amzHeaders["x-amz-acl"];
822
- const response = await this.call(S3.METHOD_PUT, uri, data, {
823
- partNumber: chunk.toString(),
824
- uploadId: uploadId,
825
- });
826
- return response.headers["etag"];
827
- }
828
- async completeMultipartUpload(path, uploadId, parts) {
829
- const uri = path !== ""
830
- ? `/${encodeURIComponent(path).replace(/%2F/g, "/").replace(/%3F/g, "?")}`
831
- : "/";
832
- let body = "<CompleteMultipartUpload>";
833
- for (const [key, etag] of Object.entries(parts)) {
834
- body += `<Part><ETag>${etag}</ETag><PartNumber>${key}</PartNumber></Part>`;
835
- }
836
- body += "</CompleteMultipartUpload>";
837
- this.amzHeaders["x-amz-content-sha256"] = this.sha256(body);
838
- this.headers["content-md5"] = Buffer.from(this.md5(body)).toString("base64");
839
- await this.call(S3.METHOD_POST, uri, body, { uploadId });
840
- return true;
841
- }
842
- async abort(path, extra = "") {
843
- const uri = path !== "" ? `/${encodeURIComponent(path).replace(/%2F/g, "/")}` : "/";
844
- delete this.headers["content-type"];
845
- this.headers["content-md5"] = Buffer.from(this.md5("")).toString("base64");
846
- await this.call(S3.METHOD_DELETE, uri, "", { uploadId: extra });
847
- return true;
848
- }
849
- async read(path, offset = 0, length) {
850
- delete this.amzHeaders["x-amz-acl"];
851
- delete this.amzHeaders["x-amz-content-sha256"];
852
- delete this.headers["content-type"];
853
- this.headers["content-md5"] = Buffer.from(this.md5("")).toString("base64");
854
- const uri = path !== "" ? `/${encodeURIComponent(path).replace(/%2F/g, "/")}` : "/";
855
- if (length !== undefined) {
856
- const end = offset + length - 1;
857
- this.headers["range"] = `bytes=${offset}-${end}`;
858
- }
859
- else {
860
- delete this.headers["range"];
861
- }
862
- const response = await this.call(S3.METHOD_GET, uri, "", {}, false);
863
- return Buffer.from(response.buffer);
864
- }
865
- async write(path, data, contentType = "") {
866
- const uri = path !== ""
867
- ? `/${encodeURIComponent(path).replace(/%2F/g, "/").replace(/%3F/g, "?")}`
868
- : "/";
869
- this.headers["content-type"] = contentType;
870
- this.headers["content-md5"] = Buffer.from(this.md5(data)).toString("base64");
871
- this.amzHeaders["x-amz-content-sha256"] = this.sha256(data);
872
- this.amzHeaders["x-amz-acl"] = this.acl;
873
- await this.call(S3.METHOD_PUT, uri, data);
874
- return true;
875
- }
876
- async delete(path, recursive = false) {
877
- const uri = path !== "" ? `/${encodeURIComponent(path).replace(/%2F/g, "/")}` : "/";
878
- delete this.headers["content-type"];
879
- delete this.amzHeaders["x-amz-acl"];
880
- delete this.amzHeaders["x-amz-content-sha256"];
881
- this.headers["content-md5"] = Buffer.from(this.md5("")).toString("base64");
882
- await this.call(S3.METHOD_DELETE, uri);
883
- return true;
884
- }
885
- async listObjects(prefix = "", maxKeys = S3.MAX_PAGE_SIZE, continuationToken = "") {
886
- if (maxKeys > S3.MAX_PAGE_SIZE) {
887
- throw new Error(`Cannot list more than ${S3.MAX_PAGE_SIZE} objects`);
888
- }
889
- const uri = "/";
890
- prefix = prefix.replace(/^\//, "");
891
- this.headers["content-type"] = "text/plain";
892
- this.headers["content-md5"] = Buffer.from(this.md5("")).toString("base64");
893
- delete this.amzHeaders["x-amz-content-sha256"];
894
- delete this.amzHeaders["x-amz-acl"];
895
- const parameters = {
896
- "list-type": "2",
897
- prefix: prefix,
898
- "max-keys": maxKeys.toString(),
899
- };
900
- if (continuationToken) {
901
- parameters["continuation-token"] = continuationToken;
902
- }
903
- const response = await this.call(S3.METHOD_GET, uri, "", parameters);
904
- return response.body;
905
- }
906
- async deletePath(path) {
907
- path = `${this.getRoot()}/${path}`;
908
- const uri = "/";
909
- let continuationToken = "";
910
- do {
911
- const objects = await this.listObjects(path, S3.MAX_PAGE_SIZE, continuationToken);
912
- const count = parseInt(objects["KeyCount"] || "1");
913
- if (count < 1)
914
- break;
915
- continuationToken = objects["NextContinuationToken"] || "";
916
- let body = '<Delete xmlns="http://s3.amazonaws.com/doc/2006-03-01/">';
917
- if (count > 1) {
918
- for (const object of objects["Contents"]) {
919
- body += `<Object><Key>${object["Key"]}</Key></Object>`;
920
- }
921
- }
922
- else {
923
- body += `<Object><Key>${objects["Contents"]["Key"]}</Key></Object>`;
924
- }
925
- body += "<Quiet>true</Quiet></Delete>";
926
- this.amzHeaders["x-amz-content-sha256"] = this.sha256(body);
927
- this.headers["content-md5"] = Buffer.from(this.md5(body)).toString("base64");
928
- await this.call(S3.METHOD_POST, uri, body, { delete: "" });
929
- } while (continuationToken);
930
- return true;
931
- }
932
- async exists(path) {
933
- try {
934
- await this.getInfo(path);
935
- return true;
936
- }
937
- catch {
938
- return false;
939
- }
940
- }
941
- async getFileSize(path) {
942
- const response = await this.getInfo(path);
943
- return parseInt(response["content-length"] || "0");
944
- }
945
- async getFileMimeType(path) {
946
- const response = await this.getInfo(path);
947
- return response["content-type"] || "";
948
- }
949
- async getFileHash(path) {
950
- const etag = (await this.getInfo(path))["etag"] || "";
951
- return etag ? etag.slice(1, -1) : etag;
952
- }
953
- async createDirectory(path) {
954
- return true; // S3 doesn't have directories
955
- }
956
- async getDirectorySize(path) {
957
- return -1;
958
- }
959
- async getPartitionFreeSpace() {
960
- return -1;
961
- }
962
- async getFiles(dir, max = S3.MAX_PAGE_SIZE, continuationToken = "") {
963
- const data = await this.listObjects(dir, max, continuationToken);
964
- data["IsTruncated"] = data["IsTruncated"] === "true";
965
- data["KeyCount"] = parseInt(data["KeyCount"]);
966
- data["MaxKeys"] = parseInt(data["MaxKeys"]);
967
- return data;
968
- }
969
- async getInfo(path) {
970
- delete this.headers["content-type"];
971
- delete this.amzHeaders["x-amz-acl"];
972
- delete this.amzHeaders["x-amz-content-sha256"];
973
- this.headers["content-md5"] = Buffer.from(this.md5("")).toString("base64");
974
- const uri = path !== "" ? `/${encodeURIComponent(path).replace(/%2F/g, "/")}` : "/";
975
- const response = await this.call(S3.METHOD_HEAD, uri);
976
- return response.headers;
977
- }
978
- getSignatureV4(method, uri, parameters = {}) {
979
- const service = "s3";
980
- const region = this.region;
981
- const algorithm = "AWS4-HMAC-SHA256";
982
- const combinedHeaders = {};
983
- const amzDateStamp = this.amzHeaders["x-amz-date"].substring(0, 8);
984
- // Combine headers
985
- for (const [k, v] of Object.entries(this.headers)) {
986
- combinedHeaders[k.toLowerCase()] = v.trim();
987
- }
988
- for (const [k, v] of Object.entries(this.amzHeaders)) {
989
- combinedHeaders[k.toLowerCase()] = v.trim();
990
- }
991
- // Sort headers
992
- const sortedHeaders = Object.keys(combinedHeaders).sort();
993
- const sortedCombinedHeaders = {};
994
- for (const key of sortedHeaders) {
995
- sortedCombinedHeaders[key] = combinedHeaders[key];
996
- }
997
- // Sort parameters
998
- const sortedParams = Object.keys(parameters).sort();
999
- const queryString = sortedParams
1000
- .map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(parameters[key])}`)
1001
- .join("&");
1002
- // Create canonical request
1003
- const canonicalRequest = [
1004
- method,
1005
- uri.split("?")[0],
1006
- queryString,
1007
- ...Object.entries(sortedCombinedHeaders).map(([k, v]) => `${k}:${v}`),
1008
- "",
1009
- Object.keys(sortedCombinedHeaders).join(";"),
1010
- this.amzHeaders["x-amz-content-sha256"],
1011
- ].join("\n");
1012
- // Create string to sign
1013
- const credentialScope = [
1014
- amzDateStamp,
1015
- region,
1016
- service,
1017
- "aws4_request",
1018
- ].join("/");
1019
- const stringToSign = [
1020
- algorithm,
1021
- this.amzHeaders["x-amz-date"],
1022
- credentialScope,
1023
- this.sha256(canonicalRequest),
1024
- ].join("\n");
1025
- // Calculate signature
1026
- const kSecret = `AWS4${this.secretKey}`;
1027
- const kDate = this.hmacSha256(amzDateStamp, kSecret);
1028
- const kRegion = this.hmacSha256(region, kDate);
1029
- const kService = this.hmacSha256(service, kRegion);
1030
- const kSigning = this.hmacSha256("aws4_request", kService);
1031
- const signature = this.hmacSha256(stringToSign, kSigning, "hex");
1032
- return `${algorithm} Credential=${this.accessKey}/${credentialScope},SignedHeaders=${Object.keys(sortedCombinedHeaders).join(";")},Signature=${signature}`;
1033
- }
1034
- async call(method, uri, data = "", parameters = {}, decode = true) {
1035
- uri = this.getAbsolutePath(uri);
1036
- const queryString = Object.keys(parameters).length
1037
- ? "?" +
1038
- Object.entries(parameters)
1039
- .map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
1040
- .join("&")
1041
- : "";
1042
- const url = `https://${this.headers["host"]}${uri}${queryString}`;
1043
- this.amzHeaders["x-amz-date"] = new Date()
1044
- .toISOString()
1045
- .replace(/[:-]|\.\d{3}/g, "");
1046
- if (!this.amzHeaders["x-amz-content-sha256"]) {
1047
- this.amzHeaders["x-amz-content-sha256"] = this.sha256(data);
1048
- }
1049
- const headers = {};
1050
- for (const [header, value] of Object.entries(this.amzHeaders)) {
1051
- if (value.length > 0) {
1052
- headers[header] = value;
1053
- }
1054
- }
1055
- this.headers["date"] = new Date().toUTCString();
1056
- for (const [header, value] of Object.entries(this.headers)) {
1057
- if (value.length > 0) {
1058
- headers[header] = value;
1059
- }
1060
- }
1061
- headers["Authorization"] = this.getSignatureV4(method, uri, parameters);
1062
- const fetchOptions = {
1063
- method,
1064
- headers,
1065
- };
1066
- if (method === S3.METHOD_PUT || method === S3.METHOD_POST) {
1067
- fetchOptions.body = data;
1068
- }
1069
- const response = await fetch(url, fetchOptions);
1070
- if (!response.ok) {
1071
- const errorBody = await response.text();
1072
- throw new Error(`HTTP ${response.status}: ${errorBody}`);
1073
- }
1074
- const responseHeaders = {};
1075
- response.headers.forEach((value, key) => {
1076
- responseHeaders[key.toLowerCase()] = value;
1077
- });
1078
- const buffer = await response.arrayBuffer();
1079
- let body = new TextDecoder().decode(buffer);
1080
- if (decode &&
1081
- (responseHeaders["content-type"] === "application/xml" ||
1082
- (body.startsWith("<?xml") &&
1083
- responseHeaders["content-type"] !== "image/svg+xml"))) {
1084
- const xml2js = await import('xml2js');
1085
- const parser = new xml2js.Parser();
1086
- body = await parser.parseStringPromise(body);
1087
- }
1088
- return {
1089
- body,
1090
- buffer,
1091
- headers: responseHeaders,
1092
- code: response.status,
1093
- };
1094
- }
1095
- md5(data) {
1096
- const buffer = typeof data === "string" ? Buffer.from(data, "utf8") : data;
1097
- return crypto.createHash("md5").update(buffer).digest();
1098
- }
1099
- sha256(data) {
1100
- const buffer = typeof data === "string" ? Buffer.from(data, "utf8") : data;
1101
- return crypto.createHash("sha256").update(buffer).digest("hex");
1102
- }
1103
- hmacSha256(data, key, encoding = "binary") {
1104
- const dataBuffer = typeof data === "string" ? Buffer.from(data, "utf8") : data;
1105
- const hmac = crypto.createHmac("sha256", key);
1106
- hmac.update(dataBuffer);
1107
- return encoding === "hex" ? hmac.digest("hex") : hmac.digest();
1108
- }
1109
- }
1110
- // HTTP Methods
1111
- S3.METHOD_GET = "GET";
1112
- S3.METHOD_POST = "POST";
1113
- S3.METHOD_PUT = "PUT";
1114
- S3.METHOD_PATCH = "PATCH";
1115
- S3.METHOD_DELETE = "DELETE";
1116
- S3.METHOD_HEAD = "HEAD";
1117
- S3.METHOD_OPTIONS = "OPTIONS";
1118
- S3.METHOD_CONNECT = "CONNECT";
1119
- S3.METHOD_TRACE = "TRACE";
1120
- // AWS Regions
1121
- S3.US_EAST_1 = "us-east-1";
1122
- S3.US_EAST_2 = "us-east-2";
1123
- S3.US_WEST_1 = "us-west-1";
1124
- S3.US_WEST_2 = "us-west-2";
1125
- S3.AF_SOUTH_1 = "af-south-1";
1126
- S3.AP_EAST_1 = "ap-east-1";
1127
- S3.AP_SOUTH_1 = "ap-south-1";
1128
- S3.AP_NORTHEAST_3 = "ap-northeast-3";
1129
- S3.AP_NORTHEAST_2 = "ap-northeast-2";
1130
- S3.AP_NORTHEAST_1 = "ap-northeast-1";
1131
- S3.AP_SOUTHEAST_1 = "ap-southeast-1";
1132
- S3.AP_SOUTHEAST_2 = "ap-southeast-2";
1133
- S3.CA_CENTRAL_1 = "ca-central-1";
1134
- S3.EU_CENTRAL_1 = "eu-central-1";
1135
- S3.EU_WEST_1 = "eu-west-1";
1136
- S3.EU_SOUTH_1 = "eu-south-1";
1137
- S3.EU_WEST_2 = "eu-west-2";
1138
- S3.EU_WEST_3 = "eu-west-3";
1139
- S3.EU_NORTH_1 = "eu-north-1";
1140
- S3.SA_EAST_1 = "eu-north-1";
1141
- S3.CN_NORTH_1 = "cn-north-1";
1142
- S3.CN_NORTH_4 = "cn-north-4";
1143
- S3.CN_NORTHWEST_1 = "cn-northwest-1";
1144
- S3.ME_SOUTH_1 = "me-south-1";
1145
- S3.US_GOV_EAST_1 = "us-gov-east-1";
1146
- S3.US_GOV_WEST_1 = "us-gov-west-1";
1147
- // ACL Flags
1148
- S3.ACL_PRIVATE = "private";
1149
- S3.ACL_PUBLIC_READ = "public-read";
1150
- S3.ACL_PUBLIC_READ_WRITE = "public-read-write";
1151
- S3.ACL_AUTHENTICATED_READ = "authenticated-read";
1152
- S3.MAX_PAGE_SIZE = 1000;
1153
- S3.retryAttempts = 3;
1154
- S3.retryDelay = 500;
1155
-
1156
- class Wasabi extends S3 {
1157
- /**
1158
- * Wasabi Constructor
1159
- */
1160
- constructor(root, accessKey, secretKey, bucket, region = Wasabi.EU_CENTRAL_1, acl = S3.ACL_PRIVATE) {
1161
- super(root, accessKey, secretKey, bucket, region, acl);
1162
- this.headers["host"] = `${bucket}.s3.${region}.wasabisys.com`;
1163
- }
1164
- getName() {
1165
- return "Wasabi Storage";
1166
- }
1167
- getDescription() {
1168
- return "Wasabi Storage";
1169
- }
1170
- getType() {
1171
- return Storage.DEVICE_WASABI;
1172
- }
1173
- }
1174
- /**
1175
- * Regions constants
1176
- */
1177
- Wasabi.US_WEST_1 = "us-west-1";
1178
- Wasabi.AP_NORTHEAST_1 = "ap-northeast-1";
1179
- Wasabi.AP_NORTHEAST_2 = "ap-northeast-2";
1180
- Wasabi.EU_CENTRAL_1 = "eu-central-1";
1181
- Wasabi.EU_CENTRAL_2 = "eu-central-2";
1182
- Wasabi.EU_WEST_1 = "eu-west-1";
1183
- Wasabi.EU_WEST_2 = "eu-west-2";
1184
- Wasabi.US_CENTRAL_1 = "us-central-1";
1185
- Wasabi.US_EAST_1 = "us-east-1";
1186
- Wasabi.US_EAST_2 = "us-east-2";
1187
-
1188
- class MinIO extends S3 {
1189
- /**
1190
- * MinIO Constructor
1191
- */
1192
- constructor(root, accessKey, secretKey, bucket, endpoint = "localhost:9000", acl = S3.ACL_PRIVATE, useSSL = false) {
1193
- const protocol = useSSL ? "https" : "http";
1194
- // Remove protocol from endpoint if it exists
1195
- const cleanEndpoint = endpoint.replace(/^https?:\/\//, "");
1196
- super(root, accessKey, secretKey, bucket, "us-east-1", acl, cleanEndpoint);
1197
- // Override the host for MinIO
1198
- this.headers["host"] = `${bucket}.${cleanEndpoint}`;
1199
- // Store the full endpoint URL for MinIO-specific operations
1200
- this.endpointUrl = `${protocol}://${cleanEndpoint}`;
1201
- }
1202
- getName() {
1203
- return "MinIO Storage";
1204
- }
1205
- getDescription() {
1206
- return "MinIO S3-compatible object storage server";
1207
- }
1208
- getType() {
1209
- return Storage.DEVICE_MINIO;
1210
- }
1211
- /**
1212
- * Override the call method to use the custom endpoint
1213
- */
1214
- async call(method, uri, data = "", parameters = {}, decode = true) {
1215
- // Temporarily modify the host header to not include the bucket for MinIO
1216
- const originalHost = this.headers["host"];
1217
- // For MinIO, we need to handle path-style URLs differently
1218
- const bucketName = originalHost.split(".")[0];
1219
- const endpoint = originalHost.split(".").slice(1).join(".");
1220
- // Use path-style URLs for MinIO
1221
- this.headers["host"] = endpoint;
1222
- const queryString = Object.keys(parameters).length
1223
- ? "?" +
1224
- Object.entries(parameters)
1225
- .map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
1226
- .join("&")
1227
- : "";
1228
- const pathStyleUri = `/${bucketName}${this.getAbsolutePath(uri)}`;
1229
- const url = `${this.endpointUrl}${pathStyleUri}${queryString}`;
1230
- this.amzHeaders["x-amz-date"] = new Date()
1231
- .toISOString()
1232
- .replace(/[:-]|\.\d{3}/g, "");
1233
- if (!this.amzHeaders["x-amz-content-sha256"]) {
1234
- this.amzHeaders["x-amz-content-sha256"] = this.sha256(data);
1235
- }
1236
- const headers = {};
1237
- for (const [header, value] of Object.entries(this.amzHeaders)) {
1238
- if (value.length > 0) {
1239
- headers[header] = value;
1240
- }
1241
- }
1242
- this.headers["date"] = new Date().toUTCString();
1243
- for (const [header, value] of Object.entries(this.headers)) {
1244
- if (value.length > 0) {
1245
- headers[header] = value;
1246
- }
1247
- }
1248
- headers["Authorization"] = this.getSignatureV4(method, pathStyleUri, parameters);
1249
- const fetchOptions = {
1250
- method,
1251
- headers,
1252
- };
1253
- if (method === S3.METHOD_PUT || method === S3.METHOD_POST) {
1254
- fetchOptions.body = data;
1255
- }
1256
- const response = await fetch(url, fetchOptions);
1257
- // Restore original host
1258
- this.headers["host"] = originalHost;
1259
- if (!response.ok) {
1260
- const errorBody = await response.text();
1261
- throw new Error(`HTTP ${response.status}: ${errorBody}`);
1262
- }
1263
- const responseHeaders = {};
1264
- response.headers.forEach((value, key) => {
1265
- responseHeaders[key.toLowerCase()] = value;
1266
- });
1267
- let body = await response.text();
1268
- if (decode &&
1269
- (responseHeaders["content-type"] === "application/xml" ||
1270
- (body.startsWith("<?xml") &&
1271
- responseHeaders["content-type"] !== "image/svg+xml"))) {
1272
- const xml2js = await import('xml2js');
1273
- const parser = new xml2js.Parser();
1274
- body = await parser.parseStringPromise(body);
1275
- }
1276
- return {
1277
- body,
1278
- headers: responseHeaders,
1279
- code: response.status,
1280
- };
1281
- }
1282
- }
1283
-
1284
- exports.Device = Device;
1285
- exports.File = File;
1286
- exports.FileExt = FileExt;
1287
- exports.FileName = FileName;
1288
- exports.FileSize = FileSize;
1289
- exports.FileType = FileType;
1290
- exports.Local = Local;
1291
- exports.MinIO = MinIO;
1292
- exports.S3 = S3;
1293
- exports.Storage = Storage;
1294
- exports.Upload = Upload;
1295
- exports.Wasabi = Wasabi;
1296
- //# sourceMappingURL=index.cjs.js.map