@bejibun/storage 0.1.1 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/benchmarks/README.md +46 -0
  3. package/benchmarks/package.json +12 -0
  4. package/benchmarks/scripts/coldstart-baseline.mjs +9 -0
  5. package/benchmarks/scripts/coldstart-optimized.mjs +9 -0
  6. package/benchmarks/scripts/coldstart.mjs +93 -0
  7. package/benchmarks/scripts/readme-writer.mjs +35 -0
  8. package/benchmarks/scripts/table-format.mjs +123 -0
  9. package/benchmarks/scripts/throughput-baseline.mjs +68 -0
  10. package/benchmarks/scripts/throughput-optimized.mjs +68 -0
  11. package/benchmarks/scripts/throughput.mjs +83 -0
  12. package/builders/StorageBuilder.d.ts +117 -0
  13. package/builders/StorageBuilder.js +156 -29
  14. package/builders/storage/StorageLocalBuilder.d.ts +89 -0
  15. package/builders/storage/StorageLocalBuilder.js +109 -21
  16. package/builders/storage/StorageS3Builder.d.ts +90 -0
  17. package/builders/storage/StorageS3Builder.js +107 -18
  18. package/config/storage.d.ts +3 -0
  19. package/config/storage.js +8 -0
  20. package/configure.js +5 -0
  21. package/enums/StorageDiskDriverEnum.d.ts +5 -0
  22. package/enums/StorageDiskDriverEnum.js +5 -0
  23. package/enums/index.d.ts +4 -1
  24. package/enums/index.js +4 -1
  25. package/exceptions/StorageException.d.ts +10 -0
  26. package/exceptions/StorageException.js +10 -0
  27. package/exceptions/index.d.ts +4 -1
  28. package/exceptions/index.js +4 -1
  29. package/facades/Storage.d.ts +87 -0
  30. package/facades/Storage.js +87 -0
  31. package/facades/index.d.ts +4 -1
  32. package/facades/index.js +4 -1
  33. package/index.d.ts +4 -0
  34. package/index.js +4 -0
  35. package/package.json +10 -9
  36. package/tests/integration/storage.integration.test.ts +145 -0
  37. package/tests/unit/storage.test.ts +177 -0
  38. package/tsconfig.json +2 -1
  39. package/types/index.d.ts +4 -1
  40. package/types/storage.d.ts +24 -24
@@ -49,90 +49,90 @@ export interface StorageDriver {
49
49
  /**
50
50
  * Determine whether a file exists.
51
51
  *
52
- * @param filepath The path to the file.
53
- * @returns True if the file exists; otherwise false.
52
+ * @param {string} filepath The path to the file.
53
+ * @returns {boolean} True if the file exists; otherwise false.
54
54
  */
55
55
  exists(filepath: string): Promise<boolean>;
56
56
 
57
57
  /**
58
58
  * Determine whether a file is missing.
59
59
  *
60
- * @param filepath The path to the file.
61
- * @returns True if the file does not exist; otherwise false.
60
+ * @param {string} filepath The path to the file.
61
+ * @returns {boolean} True if the file does not exist; otherwise false.
62
62
  */
63
63
  missing(filepath: string): Promise<boolean>;
64
64
 
65
65
  /**
66
66
  * Retrieve metadata for a file.
67
67
  *
68
- * @param filepath The path to the file.
69
- * @returns File metadata and statistics.
68
+ * @param {string} filepath The path to the file.
69
+ * @returns {Stats|Bun.S3Stats} File metadata and statistics.
70
70
  */
71
71
  metadata(filepath: string): Promise<Stats | Bun.S3Stats>;
72
72
 
73
73
  /**
74
74
  * Get the file size in bytes.
75
75
  *
76
- * @param filepath The path to the file.
77
- * @returns The file size in bytes.
76
+ * @param {string} filepath The path to the file.
77
+ * @returns {number} The file size in bytes.
78
78
  */
79
79
  size(filepath: string): Promise<number>;
80
80
 
81
81
  /**
82
82
  * Get the file MIME type.
83
83
  *
84
- * @param filepath The path to the file.
85
- * @returns The detected MIME type.
84
+ * @param {string} filepath The path to the file.
85
+ * @returns {string} The detected MIME type.
86
86
  */
87
87
  mimeType(filepath: string): Promise<string>;
88
88
 
89
89
  /**
90
90
  * Get the file's last modification date.
91
91
  *
92
- * @param filepath The path to the file.
93
- * @returns The last modified timestamp.
92
+ * @param {string} filepath The path to the file.
93
+ * @returns {Date} The last modified timestamp.
94
94
  */
95
95
  lastModified(filepath: string): Promise<Date>;
96
96
 
97
97
  /**
98
98
  * Retrieve a file from storage.
99
99
  *
100
- * @param filepath The path to the file.
101
- * @returns The storage file instance.
100
+ * @param {string} filepath The path to the file.
101
+ * @returns {Bun.BunFile|Bun.S3File} The storage file instance.
102
102
  */
103
103
  get(filepath: string): Promise<Bun.BunFile | Bun.S3File>;
104
104
 
105
105
  /**
106
106
  * Store content at the given path.
107
107
  *
108
- * @param filepath The destination file path.
109
- * @param content The content to store.
110
- * @param options Additional storage options.
108
+ * @param {string} filepath The destination file path.
109
+ * @param {any} content The content to store.
110
+ * @param {StorageOptions} options Additional storage options.
111
111
  */
112
112
  put(filepath: string, content: any, options?: StorageOptions): Promise<void>;
113
113
 
114
114
  /**
115
115
  * Copy a file to a new location.
116
116
  *
117
- * @param source The source file path.
118
- * @param destination The destination file path.
119
- * @param options Additional storage options.
117
+ * @param {string} source The source file path.
118
+ * @param {string} destination The destination file path.
119
+ * @param {StorageOptions} options Additional storage options.
120
120
  */
121
121
  copy(source: string, destination: string, options?: StorageOptions): Promise<void>;
122
122
 
123
123
  /**
124
124
  * Move a file to a new location.
125
125
  *
126
- * @param source The source file path.
127
- * @param destination The destination file path.
128
- * @param options Additional storage options.
126
+ * @param {string} source The source file path.
127
+ * @param {string} destination The destination file path.
128
+ * @param {StorageOptions} options Additional storage options.
129
129
  */
130
130
  move(source: string, destination: string, options?: StorageOptions): Promise<void>;
131
131
 
132
132
  /**
133
133
  * Delete a file from storage.
134
134
  *
135
- * @param filepath The path to the file.
135
+ * @param {string} filepath The path to the file.
136
136
  */
137
137
  delete(filepath: string): Promise<void>;
138
138
  }