@ooneex/storage 0.0.12 → 0.0.14

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.js CHANGED
@@ -1,4 +1,597 @@
1
1
  // @bun
2
- class u{client=null;setBucket(t){return this.bucket=t,this.client=new Bun.S3Client(this.getOptions()),this}async list(){return(await this.getClient().list()).contents?.map((e)=>e.key)||[]}async clearBucket(){let t=this.getClient(),e=await this.list();for(let r of e)await t.delete(r);return this}async exists(t){return await this.getClient().exists(t)}async delete(t){await this.getClient().delete(t)}async putFile(t,e){let r=Bun.file(e);return await this.put(t,r)}async put(t,e){return await this.getS3File(t).write(e)}async getAsJson(t){return await this.getS3File(t).json()}async getAsArrayBuffer(t){return await this.getS3File(t).arrayBuffer()}getAsStream(t){return this.getS3File(t).stream()}getClient(){if(!this.client)this.client=new Bun.S3Client(this.getOptions());return this.client}getS3File(t){return this.getClient().file(t)}}import{Exception as A}from"@ooneex/exception";import{HttpStatus as E}from"@ooneex/http-status";class n extends A{constructor(t,e={}){super(t,{status:E.Code.InternalServerError,data:e});this.name="StorageException"}}class y{bucket="";accessKey;storageZone;region;constructor(t){let e=t?.accessKey??Bun.env.STORAGE_BUNNY_ACCESS_KEY,r=t?.storageZone??Bun.env.STORAGE_BUNNY_STORAGE_ZONE,s=t?.region??Bun.env.STORAGE_BUNNY_REGION;if(!e)throw new n("Bunny access key is required. Please provide an access key either through the constructor options or set the STORAGE_BUNNY_ACCESS_KEY environment variable.");if(!r)throw new n("Bunny storage zone is required. Please provide a storage zone either through the constructor options or set the STORAGE_BUNNY_STORAGE_ZONE environment variable.");this.accessKey=e,this.storageZone=r,this.region=s??"de"}setBucket(t){return this.bucket=t,this}async list(){let t=this.bucket?`${this.bucket}/`:"",e=`${this.getBaseUrl()}/${this.storageZone}/${t}`,r=await fetch(e,{method:"GET",headers:{AccessKey:this.accessKey,accept:"application/json"}});if(!r.ok)throw new n(`Failed to list files: ${r.status} ${r.statusText}`,{status:r.status,path:t});return(await r.json()).filter((i)=>!i.IsDirectory).map((i)=>i.ObjectName)}async clearBucket(){let t=await this.list();for(let e of t)await this.delete(e);return this}async exists(t){let e=this.buildFileUrl(t);return(await fetch(e,{method:"GET",headers:{AccessKey:this.accessKey}})).ok}async delete(t){let e=this.buildFileUrl(t),r=await fetch(e,{method:"DELETE",headers:{AccessKey:this.accessKey}});if(!r.ok&&r.status!==404)throw new n(`Failed to delete file: ${r.status} ${r.statusText}`,{status:r.status,key:t})}async putFile(t,e){let r=Bun.file(e);return await this.put(t,r)}async put(t,e){let r=this.buildFileUrl(t),s,i;if(typeof e==="string")s=e,i=new TextEncoder().encode(e).length;else if(e instanceof ArrayBuffer)s=new Blob([e]),i=e.byteLength;else if(e instanceof SharedArrayBuffer){let o=new Uint8Array(e),c=new Uint8Array(o.length);c.set(o),s=new Blob([c]),i=e.byteLength}else if(ArrayBuffer.isView(e)){let o=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);s=new Blob([o]),i=e.byteLength}else if(e instanceof Blob)s=e,i=e.size;else if(e instanceof Request||e instanceof Response){let o=await e.arrayBuffer();s=new Blob([o]),i=o.byteLength}else if(typeof e==="object"&&e!==null&&"arrayBuffer"in e){let c=await e.arrayBuffer();s=new Blob([c]),i=c.byteLength}else throw new n("Unsupported content type for upload",{key:t});let a=await fetch(r,{method:"PUT",headers:{AccessKey:this.accessKey,"Content-Type":"application/octet-stream"},body:s});if(!a.ok)throw new n(`Failed to upload file: ${a.status} ${a.statusText}`,{status:a.status,key:t});return i}async getAsJson(t){let e=this.buildFileUrl(t),r=await fetch(e,{method:"GET",headers:{AccessKey:this.accessKey}});if(!r.ok)throw new n(`Failed to get file as JSON: ${r.status} ${r.statusText}`,{status:r.status,key:t});return await r.json()}async getAsArrayBuffer(t){let e=this.buildFileUrl(t),r=await fetch(e,{method:"GET",headers:{AccessKey:this.accessKey}});if(!r.ok)throw new n(`Failed to get file as ArrayBuffer: ${r.status} ${r.statusText}`,{status:r.status,key:t});return await r.arrayBuffer()}getAsStream(t){let e=this.buildFileUrl(t);return new ReadableStream({start:async(s)=>{let i=await fetch(e,{method:"GET",headers:{AccessKey:this.accessKey}});if(!i.ok){s.error(new n(`Failed to get file as stream: ${i.status} ${i.statusText}`,{status:i.status,key:t}));return}if(!i.body){s.error(new n("Response body is null",{key:t}));return}let a=i.body.getReader(),o=async()=>{let{done:c,value:S}=await a.read();if(c){s.close();return}s.enqueue(S),await o()};await o()}})}getBaseUrl(){return`https://${{de:"storage.bunnycdn.com",uk:"uk.storage.bunnycdn.com",ny:"ny.storage.bunnycdn.com",la:"la.storage.bunnycdn.com",sg:"sg.storage.bunnycdn.com",se:"se.storage.bunnycdn.com",br:"br.storage.bunnycdn.com",jh:"jh.storage.bunnycdn.com",syd:"syd.storage.bunnycdn.com"}[this.region]}`}buildFileUrl(t){let e=this.bucket?`${this.bucket}/${t}`:t;return`${this.getBaseUrl()}/${this.storageZone}/${e}`}}class p extends u{bucket;accessKey;secretKey;endpoint;region;constructor(t){super();let e=t?.accessKey||Bun.env.STORAGE_CLOUDFLARE_ACCESS_KEY,r=t?.secretKey||Bun.env.STORAGE_CLOUDFLARE_SECRET_KEY,s=t?.endpoint||Bun.env.STORAGE_CLOUDFLARE_ENDPOINT;if(!e)throw new n("Cloudflare access key is required. Please provide an access key either through the constructor options or set the STORAGE_CLOUDFLARE_ACCESS_KEY environment variable.");if(!r)throw new n("Cloudflare secret key is required. Please provide a secret key either through the constructor options or set the STORAGE_CLOUDFLARE_SECRET_KEY environment variable.");if(!s)throw new n("Cloudflare endpoint is required. Please provide an endpoint either through the constructor options or set the STORAGE_CLOUDFLARE_ENDPOINT environment variable.");this.accessKey=e,this.secretKey=r,this.endpoint=s,this.region=t?.region||Bun.env.STORAGE_CLOUDFLARE_REGION||"EEUR"}getOptions(){return{accessKeyId:this.accessKey,secretAccessKey:this.secretKey,endpoint:this.endpoint,bucket:this.bucket,region:this.region}}}import{container as F,EContainerScope as P}from"@ooneex/container";var v={storage:(t=P.Singleton)=>{return(e)=>{F.add(e,t)}}};import{existsSync as l,mkdirSync as d}from"fs";import{mkdir as m,readdir as h,rmdir as b,stat as w}from"fs/promises";import{dirname as g,join as f}from"path";class B extends u{bucket;storagePath;constructor(t){super();let e=t?.storagePath||Bun.env.FILESYSTEM_STORAGE_PATH;if(!e)throw new n("Base path is required. Please provide a base path either through the constructor options or set the FILESYSTEM_STORAGE_PATH environment variable.");this.storagePath=e;try{if(!l(e))d(e,{recursive:!0})}catch(r){throw new n(`Failed to create base storage directory at ${e}: ${r instanceof Error?r.message:String(r)}`)}}getOptions(){return{accessKeyId:"filesystem",secretAccessKey:"filesystem",endpoint:this.storagePath,bucket:this.bucket,region:"local"}}getBucketPath(){if(!this.bucket)throw new n("Bucket name is required. Please call setBucket() first.");return f(this.storagePath,this.bucket)}getFilePath(t){return f(this.getBucketPath(),t)}setBucket(t){this.bucket=t;let e=this.getBucketPath();try{if(!l(e))d(e,{recursive:!0})}catch(r){throw new n(`Failed to create bucket directory at ${e}: ${r instanceof Error?r.message:String(r)}`)}return this}async list(){let t=this.getBucketPath();if(!l(t))return[];try{return await this.listFilesRecursive(t,t)}catch(e){throw new n(`Failed to list files in bucket: ${e instanceof Error?e.message:String(e)}`)}}async listFilesRecursive(t,e){let r=[],s=await h(t);for(let i of s){let a=f(t,i);if((await w(a)).isDirectory()){let c=await this.listFilesRecursive(a,e);r.push(...c)}else{let c=a.substring(e.length+1);r.push(c)}}return r}async clearBucket(){let t=this.getBucketPath();if(!l(t))return this;try{await this.removeDirectoryRecursive(t),await m(t,{recursive:!0})}catch(e){throw new n(`Failed to clear bucket: ${e instanceof Error?e.message:String(e)}`)}return this}async removeDirectoryRecursive(t){let e=await h(t);for(let r of e){let s=f(t,r);if((await w(s)).isDirectory())await this.removeDirectoryRecursive(s),await b(s);else await Bun.file(s).delete()}}async exists(t){let e=this.getFilePath(t);return await Bun.file(e).exists()}async delete(t){let e=this.getFilePath(t),r=Bun.file(e);if(!await r.exists())return;try{await r.delete();let s=g(e),i=this.getBucketPath();while(s!==i&&s!==this.storagePath)try{if((await h(s)).length===0)await b(s),s=g(s);else break}catch{break}}catch(s){throw new n(`Failed to delete file ${t}: ${s instanceof Error?s.message:String(s)}`)}}async putFile(t,e){let r=Bun.file(e);return await this.put(t,r)}async put(t,e){let r=this.getFilePath(t),s=g(r);try{if(!l(s))await m(s,{recursive:!0})}catch(i){throw new n(`Failed to create directory ${s}: ${i instanceof Error?i.message:String(i)}`)}try{let i;if(typeof e==="string")i=await Bun.write(r,e);else if(e instanceof ArrayBuffer)i=await Bun.write(r,e);else if(e instanceof SharedArrayBuffer){let a=new ArrayBuffer(e.byteLength);new Uint8Array(a).set(new Uint8Array(e)),i=await Bun.write(r,a)}else if(e instanceof Request){let a=await e.arrayBuffer();i=await Bun.write(r,a)}else if(e instanceof Response){let a=await e.arrayBuffer();i=await Bun.write(r,a)}else if(e instanceof Blob)i=await Bun.write(r,e);else{let a=await e.arrayBuffer();i=await Bun.write(r,a)}return i}catch(i){throw new n(`Failed to write file ${t}: ${i instanceof Error?i.message:String(i)}`)}}async getAsJson(t){let e=this.getFilePath(t),r=Bun.file(e);if(!await r.exists())throw new n(`File ${t} does not exist`);try{return await r.json()}catch(s){throw new n(`Failed to read file ${t} as JSON: ${s instanceof Error?s.message:String(s)}`)}}async getAsArrayBuffer(t){let e=this.getFilePath(t),r=Bun.file(e);if(!await r.exists())throw new n(`File ${t} does not exist`);try{return await r.arrayBuffer()}catch(s){throw new n(`Failed to read file ${t} as ArrayBuffer: ${s instanceof Error?s.message:String(s)}`)}}getAsStream(t){let e=this.getFilePath(t);if(!l(e))throw new n(`File ${t} does not exist`);let r=Bun.file(e);try{return r.stream()}catch(s){throw new n(`Failed to read file ${t} as stream: ${s instanceof Error?s.message:String(s)}`)}}}export{v as decorator,n as StorageException,B as FilesystemStorage,p as CloudflareStorage,y as BunnyStorage,u as AbstractStorage};
2
+ var __legacyDecorateClassTS = function(decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
5
+ r = Reflect.decorate(decorators, target, key, desc);
6
+ else
7
+ for (var i = decorators.length - 1;i >= 0; i--)
8
+ if (d = decorators[i])
9
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
11
+ };
12
+ var __legacyMetadataTS = (k, v) => {
13
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
14
+ return Reflect.metadata(k, v);
15
+ };
3
16
 
4
- //# debugId=5DA9047CB989080064756E2164756E21
17
+ // src/AbstractStorage.ts
18
+ class AbstractStorage {
19
+ client = null;
20
+ setBucket(name) {
21
+ this.bucket = name;
22
+ this.client = new Bun.S3Client(this.getOptions());
23
+ return this;
24
+ }
25
+ async list() {
26
+ const client = this.getClient();
27
+ return (await client.list()).contents?.map((content) => content.key) || [];
28
+ }
29
+ async clearBucket() {
30
+ const client = this.getClient();
31
+ const keys = await this.list();
32
+ for (const key of keys) {
33
+ await client.delete(key);
34
+ }
35
+ return this;
36
+ }
37
+ async exists(key) {
38
+ const client = this.getClient();
39
+ return await client.exists(key);
40
+ }
41
+ async delete(key) {
42
+ const client = this.getClient();
43
+ await client.delete(key);
44
+ }
45
+ async putFile(key, localPath) {
46
+ const file = Bun.file(localPath);
47
+ return await this.put(key, file);
48
+ }
49
+ async put(key, content) {
50
+ const s3file = this.getS3File(key);
51
+ return await s3file.write(content);
52
+ }
53
+ async getAsJson(key) {
54
+ const s3file = this.getS3File(key);
55
+ return await s3file.json();
56
+ }
57
+ async getAsArrayBuffer(key) {
58
+ const s3file = this.getS3File(key);
59
+ return await s3file.arrayBuffer();
60
+ }
61
+ getAsStream(key) {
62
+ const s3file = this.getS3File(key);
63
+ return s3file.stream();
64
+ }
65
+ getClient() {
66
+ if (!this.client) {
67
+ this.client = new Bun.S3Client(this.getOptions());
68
+ }
69
+ return this.client;
70
+ }
71
+ getS3File(path) {
72
+ const client = this.getClient();
73
+ return client.file(path);
74
+ }
75
+ }
76
+ // src/decorators.ts
77
+ import { container, EContainerScope } from "@ooneex/container";
78
+ var decorator = {
79
+ storage: (scope = EContainerScope.Singleton) => {
80
+ return (target) => {
81
+ container.add(target, scope);
82
+ };
83
+ }
84
+ };
85
+
86
+ // src/StorageException.ts
87
+ import { Exception } from "@ooneex/exception";
88
+ import { HttpStatus } from "@ooneex/http-status";
89
+
90
+ class StorageException extends Exception {
91
+ constructor(message, data = {}) {
92
+ super(message, {
93
+ status: HttpStatus.Code.InternalServerError,
94
+ data
95
+ });
96
+ this.name = "StorageException";
97
+ }
98
+ }
99
+
100
+ // src/BunnyStorage.ts
101
+ class BunnyStorage {
102
+ bucket = "";
103
+ accessKey;
104
+ storageZone;
105
+ region;
106
+ constructor(options) {
107
+ const accessKey = options?.accessKey ?? Bun.env.STORAGE_BUNNY_ACCESS_KEY;
108
+ const storageZone = options?.storageZone ?? Bun.env.STORAGE_BUNNY_STORAGE_ZONE;
109
+ const region = options?.region ?? Bun.env.STORAGE_BUNNY_REGION;
110
+ if (!accessKey) {
111
+ throw new StorageException("Bunny access key is required. Please provide an access key either through the constructor options or set the STORAGE_BUNNY_ACCESS_KEY environment variable.");
112
+ }
113
+ if (!storageZone) {
114
+ throw new StorageException("Bunny storage zone is required. Please provide a storage zone either through the constructor options or set the STORAGE_BUNNY_STORAGE_ZONE environment variable.");
115
+ }
116
+ this.accessKey = accessKey;
117
+ this.storageZone = storageZone;
118
+ this.region = region ?? "de";
119
+ }
120
+ setBucket(name) {
121
+ this.bucket = name;
122
+ return this;
123
+ }
124
+ async list() {
125
+ const path = this.bucket ? `${this.bucket}/` : "";
126
+ const url = `${this.getBaseUrl()}/${this.storageZone}/${path}`;
127
+ const response = await fetch(url, {
128
+ method: "GET",
129
+ headers: {
130
+ AccessKey: this.accessKey,
131
+ accept: "application/json"
132
+ }
133
+ });
134
+ if (!response.ok) {
135
+ throw new StorageException(`Failed to list files: ${response.status} ${response.statusText}`, {
136
+ status: response.status,
137
+ path
138
+ });
139
+ }
140
+ const files = await response.json();
141
+ return files.filter((file) => !file.IsDirectory).map((file) => file.ObjectName);
142
+ }
143
+ async clearBucket() {
144
+ const keys = await this.list();
145
+ for (const key of keys) {
146
+ await this.delete(key);
147
+ }
148
+ return this;
149
+ }
150
+ async exists(key) {
151
+ const url = this.buildFileUrl(key);
152
+ const response = await fetch(url, {
153
+ method: "GET",
154
+ headers: {
155
+ AccessKey: this.accessKey
156
+ }
157
+ });
158
+ return response.ok;
159
+ }
160
+ async delete(key) {
161
+ const url = this.buildFileUrl(key);
162
+ const response = await fetch(url, {
163
+ method: "DELETE",
164
+ headers: {
165
+ AccessKey: this.accessKey
166
+ }
167
+ });
168
+ if (!response.ok && response.status !== 404) {
169
+ throw new StorageException(`Failed to delete file: ${response.status} ${response.statusText}`, {
170
+ status: response.status,
171
+ key
172
+ });
173
+ }
174
+ }
175
+ async putFile(key, localPath) {
176
+ const file = Bun.file(localPath);
177
+ return await this.put(key, file);
178
+ }
179
+ async put(key, content) {
180
+ const url = this.buildFileUrl(key);
181
+ let body;
182
+ let contentLength;
183
+ if (typeof content === "string") {
184
+ body = content;
185
+ contentLength = new TextEncoder().encode(content).length;
186
+ } else if (content instanceof ArrayBuffer) {
187
+ body = new Blob([content]);
188
+ contentLength = content.byteLength;
189
+ } else if (content instanceof SharedArrayBuffer) {
190
+ const uint8Array = new Uint8Array(content);
191
+ const copiedArray = new Uint8Array(uint8Array.length);
192
+ copiedArray.set(uint8Array);
193
+ body = new Blob([copiedArray]);
194
+ contentLength = content.byteLength;
195
+ } else if (ArrayBuffer.isView(content)) {
196
+ const arrayBuffer = content.buffer.slice(content.byteOffset, content.byteOffset + content.byteLength);
197
+ body = new Blob([arrayBuffer]);
198
+ contentLength = content.byteLength;
199
+ } else if (content instanceof Blob) {
200
+ body = content;
201
+ contentLength = content.size;
202
+ } else if (content instanceof Request || content instanceof Response) {
203
+ const arrayBuffer = await content.arrayBuffer();
204
+ body = new Blob([arrayBuffer]);
205
+ contentLength = arrayBuffer.byteLength;
206
+ } else if (typeof content === "object" && content !== null && "arrayBuffer" in content) {
207
+ const fileContent = content;
208
+ const arrayBuffer = await fileContent.arrayBuffer();
209
+ body = new Blob([arrayBuffer]);
210
+ contentLength = arrayBuffer.byteLength;
211
+ } else {
212
+ throw new StorageException("Unsupported content type for upload", { key });
213
+ }
214
+ const response = await fetch(url, {
215
+ method: "PUT",
216
+ headers: {
217
+ AccessKey: this.accessKey,
218
+ "Content-Type": "application/octet-stream"
219
+ },
220
+ body
221
+ });
222
+ if (!response.ok) {
223
+ throw new StorageException(`Failed to upload file: ${response.status} ${response.statusText}`, {
224
+ status: response.status,
225
+ key
226
+ });
227
+ }
228
+ return contentLength;
229
+ }
230
+ async getAsJson(key) {
231
+ const url = this.buildFileUrl(key);
232
+ const response = await fetch(url, {
233
+ method: "GET",
234
+ headers: {
235
+ AccessKey: this.accessKey
236
+ }
237
+ });
238
+ if (!response.ok) {
239
+ throw new StorageException(`Failed to get file as JSON: ${response.status} ${response.statusText}`, {
240
+ status: response.status,
241
+ key
242
+ });
243
+ }
244
+ return await response.json();
245
+ }
246
+ async getAsArrayBuffer(key) {
247
+ const url = this.buildFileUrl(key);
248
+ const response = await fetch(url, {
249
+ method: "GET",
250
+ headers: {
251
+ AccessKey: this.accessKey
252
+ }
253
+ });
254
+ if (!response.ok) {
255
+ throw new StorageException(`Failed to get file as ArrayBuffer: ${response.status} ${response.statusText}`, {
256
+ status: response.status,
257
+ key
258
+ });
259
+ }
260
+ return await response.arrayBuffer();
261
+ }
262
+ getAsStream(key) {
263
+ const url = this.buildFileUrl(key);
264
+ const stream = new ReadableStream({
265
+ start: async (controller) => {
266
+ const response = await fetch(url, {
267
+ method: "GET",
268
+ headers: {
269
+ AccessKey: this.accessKey
270
+ }
271
+ });
272
+ if (!response.ok) {
273
+ controller.error(new StorageException(`Failed to get file as stream: ${response.status} ${response.statusText}`, {
274
+ status: response.status,
275
+ key
276
+ }));
277
+ return;
278
+ }
279
+ if (!response.body) {
280
+ controller.error(new StorageException("Response body is null", { key }));
281
+ return;
282
+ }
283
+ const reader = response.body.getReader();
284
+ const pump = async () => {
285
+ const { done, value } = await reader.read();
286
+ if (done) {
287
+ controller.close();
288
+ return;
289
+ }
290
+ controller.enqueue(value);
291
+ await pump();
292
+ };
293
+ await pump();
294
+ }
295
+ });
296
+ return stream;
297
+ }
298
+ getBaseUrl() {
299
+ const regionEndpoints = {
300
+ de: "storage.bunnycdn.com",
301
+ uk: "uk.storage.bunnycdn.com",
302
+ ny: "ny.storage.bunnycdn.com",
303
+ la: "la.storage.bunnycdn.com",
304
+ sg: "sg.storage.bunnycdn.com",
305
+ se: "se.storage.bunnycdn.com",
306
+ br: "br.storage.bunnycdn.com",
307
+ jh: "jh.storage.bunnycdn.com",
308
+ syd: "syd.storage.bunnycdn.com"
309
+ };
310
+ return `https://${regionEndpoints[this.region]}`;
311
+ }
312
+ buildFileUrl(key) {
313
+ const path = this.bucket ? `${this.bucket}/${key}` : key;
314
+ return `${this.getBaseUrl()}/${this.storageZone}/${path}`;
315
+ }
316
+ }
317
+ BunnyStorage = __legacyDecorateClassTS([
318
+ decorator.storage(),
319
+ __legacyMetadataTS("design:paramtypes", [
320
+ Object
321
+ ])
322
+ ], BunnyStorage);
323
+ // src/CloudflareStorage.ts
324
+ class CloudflareStorage extends AbstractStorage {
325
+ bucket;
326
+ accessKey;
327
+ secretKey;
328
+ endpoint;
329
+ region;
330
+ constructor(options) {
331
+ super();
332
+ const accessKey = options?.accessKey || Bun.env.STORAGE_CLOUDFLARE_ACCESS_KEY;
333
+ const secretKey = options?.secretKey || Bun.env.STORAGE_CLOUDFLARE_SECRET_KEY;
334
+ const endpoint = options?.endpoint || Bun.env.STORAGE_CLOUDFLARE_ENDPOINT;
335
+ if (!accessKey) {
336
+ throw new StorageException("Cloudflare access key is required. Please provide an access key either through the constructor options or set the STORAGE_CLOUDFLARE_ACCESS_KEY environment variable.");
337
+ }
338
+ if (!secretKey) {
339
+ throw new StorageException("Cloudflare secret key is required. Please provide a secret key either through the constructor options or set the STORAGE_CLOUDFLARE_SECRET_KEY environment variable.");
340
+ }
341
+ if (!endpoint) {
342
+ throw new StorageException("Cloudflare endpoint is required. Please provide an endpoint either through the constructor options or set the STORAGE_CLOUDFLARE_ENDPOINT environment variable.");
343
+ }
344
+ this.accessKey = accessKey;
345
+ this.secretKey = secretKey;
346
+ this.endpoint = endpoint;
347
+ this.region = options?.region || Bun.env.STORAGE_CLOUDFLARE_REGION || "EEUR";
348
+ }
349
+ getOptions() {
350
+ return {
351
+ accessKeyId: this.accessKey,
352
+ secretAccessKey: this.secretKey,
353
+ endpoint: this.endpoint,
354
+ bucket: this.bucket,
355
+ region: this.region
356
+ };
357
+ }
358
+ }
359
+ CloudflareStorage = __legacyDecorateClassTS([
360
+ decorator.storage(),
361
+ __legacyMetadataTS("design:paramtypes", [
362
+ Object
363
+ ])
364
+ ], CloudflareStorage);
365
+ // src/FilesystemStorage.ts
366
+ import { existsSync, mkdirSync } from "fs";
367
+ import { mkdir, readdir, rmdir, stat } from "fs/promises";
368
+ import { dirname, join } from "path";
369
+ class FilesystemStorage extends AbstractStorage {
370
+ bucket;
371
+ storagePath;
372
+ constructor(options) {
373
+ super();
374
+ const basePath = options?.storagePath || Bun.env.FILESYSTEM_STORAGE_PATH;
375
+ if (!basePath) {
376
+ throw new StorageException("Base path is required. Please provide a base path either through the constructor options or set the FILESYSTEM_STORAGE_PATH environment variable.");
377
+ }
378
+ this.storagePath = basePath;
379
+ try {
380
+ if (!existsSync(basePath)) {
381
+ mkdirSync(basePath, { recursive: true });
382
+ }
383
+ } catch (error) {
384
+ throw new StorageException(`Failed to create base storage directory at ${basePath}: ${error instanceof Error ? error.message : String(error)}`);
385
+ }
386
+ }
387
+ getOptions() {
388
+ return {
389
+ accessKeyId: "filesystem",
390
+ secretAccessKey: "filesystem",
391
+ endpoint: this.storagePath,
392
+ bucket: this.bucket,
393
+ region: "local"
394
+ };
395
+ }
396
+ getBucketPath() {
397
+ if (!this.bucket) {
398
+ throw new StorageException("Bucket name is required. Please call setBucket() first.");
399
+ }
400
+ return join(this.storagePath, this.bucket);
401
+ }
402
+ getFilePath(key) {
403
+ return join(this.getBucketPath(), key);
404
+ }
405
+ setBucket(name) {
406
+ this.bucket = name;
407
+ const bucketPath = this.getBucketPath();
408
+ try {
409
+ if (!existsSync(bucketPath)) {
410
+ mkdirSync(bucketPath, { recursive: true });
411
+ }
412
+ } catch (error) {
413
+ throw new StorageException(`Failed to create bucket directory at ${bucketPath}: ${error instanceof Error ? error.message : String(error)}`);
414
+ }
415
+ return this;
416
+ }
417
+ async list() {
418
+ const bucketPath = this.getBucketPath();
419
+ if (!existsSync(bucketPath)) {
420
+ return [];
421
+ }
422
+ try {
423
+ const files = await this.listFilesRecursive(bucketPath, bucketPath);
424
+ return files;
425
+ } catch (error) {
426
+ throw new StorageException(`Failed to list files in bucket: ${error instanceof Error ? error.message : String(error)}`);
427
+ }
428
+ }
429
+ async listFilesRecursive(dir, baseDir) {
430
+ const files = [];
431
+ const entries = await readdir(dir);
432
+ for (const entry of entries) {
433
+ const fullPath = join(dir, entry);
434
+ const stats = await stat(fullPath);
435
+ if (stats.isDirectory()) {
436
+ const subFiles = await this.listFilesRecursive(fullPath, baseDir);
437
+ files.push(...subFiles);
438
+ } else {
439
+ const relativePath = fullPath.substring(baseDir.length + 1);
440
+ files.push(relativePath);
441
+ }
442
+ }
443
+ return files;
444
+ }
445
+ async clearBucket() {
446
+ const bucketPath = this.getBucketPath();
447
+ if (!existsSync(bucketPath)) {
448
+ return this;
449
+ }
450
+ try {
451
+ await this.removeDirectoryRecursive(bucketPath);
452
+ await mkdir(bucketPath, { recursive: true });
453
+ } catch (error) {
454
+ throw new StorageException(`Failed to clear bucket: ${error instanceof Error ? error.message : String(error)}`);
455
+ }
456
+ return this;
457
+ }
458
+ async removeDirectoryRecursive(dir) {
459
+ const entries = await readdir(dir);
460
+ for (const entry of entries) {
461
+ const fullPath = join(dir, entry);
462
+ const stats = await stat(fullPath);
463
+ if (stats.isDirectory()) {
464
+ await this.removeDirectoryRecursive(fullPath);
465
+ await rmdir(fullPath);
466
+ } else {
467
+ const file = Bun.file(fullPath);
468
+ await file.delete();
469
+ }
470
+ }
471
+ }
472
+ async exists(key) {
473
+ const filePath = this.getFilePath(key);
474
+ const file = Bun.file(filePath);
475
+ return await file.exists();
476
+ }
477
+ async delete(key) {
478
+ const filePath = this.getFilePath(key);
479
+ const file = Bun.file(filePath);
480
+ if (!await file.exists()) {
481
+ return;
482
+ }
483
+ try {
484
+ await file.delete();
485
+ let parentDir = dirname(filePath);
486
+ const bucketPath = this.getBucketPath();
487
+ while (parentDir !== bucketPath && parentDir !== this.storagePath) {
488
+ try {
489
+ const entries = await readdir(parentDir);
490
+ if (entries.length === 0) {
491
+ await rmdir(parentDir);
492
+ parentDir = dirname(parentDir);
493
+ } else {
494
+ break;
495
+ }
496
+ } catch {
497
+ break;
498
+ }
499
+ }
500
+ } catch (error) {
501
+ throw new StorageException(`Failed to delete file ${key}: ${error instanceof Error ? error.message : String(error)}`);
502
+ }
503
+ }
504
+ async putFile(key, localPath) {
505
+ const file = Bun.file(localPath);
506
+ return await this.put(key, file);
507
+ }
508
+ async put(key, content) {
509
+ const filePath = this.getFilePath(key);
510
+ const dir = dirname(filePath);
511
+ try {
512
+ if (!existsSync(dir)) {
513
+ await mkdir(dir, { recursive: true });
514
+ }
515
+ } catch (error) {
516
+ throw new StorageException(`Failed to create directory ${dir}: ${error instanceof Error ? error.message : String(error)}`);
517
+ }
518
+ try {
519
+ let bytesWritten;
520
+ if (typeof content === "string") {
521
+ bytesWritten = await Bun.write(filePath, content);
522
+ } else if (content instanceof ArrayBuffer) {
523
+ bytesWritten = await Bun.write(filePath, content);
524
+ } else if (content instanceof SharedArrayBuffer) {
525
+ const arrayBuffer = new ArrayBuffer(content.byteLength);
526
+ new Uint8Array(arrayBuffer).set(new Uint8Array(content));
527
+ bytesWritten = await Bun.write(filePath, arrayBuffer);
528
+ } else if (content instanceof Request) {
529
+ const arrayBuffer = await content.arrayBuffer();
530
+ bytesWritten = await Bun.write(filePath, arrayBuffer);
531
+ } else if (content instanceof Response) {
532
+ const arrayBuffer = await content.arrayBuffer();
533
+ bytesWritten = await Bun.write(filePath, arrayBuffer);
534
+ } else if (content instanceof Blob) {
535
+ bytesWritten = await Bun.write(filePath, content);
536
+ } else {
537
+ const arrayBuffer = await content.arrayBuffer();
538
+ bytesWritten = await Bun.write(filePath, arrayBuffer);
539
+ }
540
+ return bytesWritten;
541
+ } catch (error) {
542
+ throw new StorageException(`Failed to write file ${key}: ${error instanceof Error ? error.message : String(error)}`);
543
+ }
544
+ }
545
+ async getAsJson(key) {
546
+ const filePath = this.getFilePath(key);
547
+ const file = Bun.file(filePath);
548
+ if (!await file.exists()) {
549
+ throw new StorageException(`File ${key} does not exist`);
550
+ }
551
+ try {
552
+ return await file.json();
553
+ } catch (error) {
554
+ throw new StorageException(`Failed to read file ${key} as JSON: ${error instanceof Error ? error.message : String(error)}`);
555
+ }
556
+ }
557
+ async getAsArrayBuffer(key) {
558
+ const filePath = this.getFilePath(key);
559
+ const file = Bun.file(filePath);
560
+ if (!await file.exists()) {
561
+ throw new StorageException(`File ${key} does not exist`);
562
+ }
563
+ try {
564
+ return await file.arrayBuffer();
565
+ } catch (error) {
566
+ throw new StorageException(`Failed to read file ${key} as ArrayBuffer: ${error instanceof Error ? error.message : String(error)}`);
567
+ }
568
+ }
569
+ getAsStream(key) {
570
+ const filePath = this.getFilePath(key);
571
+ if (!existsSync(filePath)) {
572
+ throw new StorageException(`File ${key} does not exist`);
573
+ }
574
+ const file = Bun.file(filePath);
575
+ try {
576
+ return file.stream();
577
+ } catch (error) {
578
+ throw new StorageException(`Failed to read file ${key} as stream: ${error instanceof Error ? error.message : String(error)}`);
579
+ }
580
+ }
581
+ }
582
+ FilesystemStorage = __legacyDecorateClassTS([
583
+ decorator.storage(),
584
+ __legacyMetadataTS("design:paramtypes", [
585
+ Object
586
+ ])
587
+ ], FilesystemStorage);
588
+ export {
589
+ decorator,
590
+ StorageException,
591
+ FilesystemStorage,
592
+ CloudflareStorage,
593
+ BunnyStorage,
594
+ AbstractStorage
595
+ };
596
+
597
+ //# debugId=8442052D0CEFBD6864756E2164756E21
package/dist/index.js.map CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["src/AbstractStorage.ts", "src/StorageException.ts", "src/BunnyStorage.ts", "src/CloudflareStorage.ts", "src/decorators.ts", "src/FilesystemStorage.ts"],
3
+ "sources": ["src/AbstractStorage.ts", "src/decorators.ts", "src/StorageException.ts", "src/BunnyStorage.ts", "src/CloudflareStorage.ts", "src/FilesystemStorage.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { BunFile, S3File, S3Options } from \"bun\";\nimport type { IStorage } from \"./types\";\n\nexport abstract class AbstractStorage implements IStorage {\n protected client: Bun.S3Client | null = null;\n public abstract getOptions(): S3Options;\n protected abstract bucket: string;\n\n public setBucket(name: string): this {\n this.bucket = name;\n this.client = new Bun.S3Client(this.getOptions());\n\n return this;\n }\n\n public async list(): Promise<string[]> {\n const client = this.getClient();\n\n return (await client.list()).contents?.map((content) => content.key) || [];\n }\n\n public async clearBucket(): Promise<this> {\n const client = this.getClient();\n const keys = await this.list();\n\n for (const key of keys) {\n await client.delete(key);\n }\n\n return this;\n }\n\n public async exists(key: string): Promise<boolean> {\n const client = this.getClient();\n\n return await client.exists(key);\n }\n\n public async delete(key: string): Promise<void> {\n const client = this.getClient();\n\n await client.delete(key);\n }\n\n public async putFile(key: string, localPath: string): Promise<number> {\n const file = Bun.file(localPath);\n\n return await this.put(key, file);\n }\n\n public async put(\n key: string,\n content: string | ArrayBuffer | SharedArrayBuffer | Request | Response | BunFile | S3File | Blob,\n ): Promise<number> {\n const s3file: S3File = this.getS3File(key);\n\n return await s3file.write(content);\n }\n\n public async getAsJson<T>(key: string): Promise<T> {\n const s3file: S3File = this.getS3File(key);\n\n return await s3file.json();\n }\n\n public async getAsArrayBuffer(key: string): Promise<ArrayBuffer> {\n const s3file: S3File = this.getS3File(key);\n\n return await s3file.arrayBuffer();\n }\n\n public getAsStream(key: string): ReadableStream {\n const s3file: S3File = this.getS3File(key);\n\n return s3file.stream();\n }\n\n protected getClient(): Bun.S3Client {\n if (!this.client) {\n this.client = new Bun.S3Client(this.getOptions());\n }\n\n return this.client;\n }\n\n protected getS3File(path: string): S3File {\n const client = this.getClient();\n\n return client.file(path);\n }\n}\n",
6
- "import { Exception } from \"@ooneex/exception\";\nimport { HttpStatus } from \"@ooneex/http-status\";\n\nexport class StorageException extends Exception {\n constructor(message: string, data: Record<string, unknown> = {}) {\n super(message, {\n status: HttpStatus.Code.InternalServerError,\n data,\n });\n this.name = \"StorageException\";\n }\n}\n",
7
- "import type { BunFile, S3File } from \"bun\";\nimport { StorageException } from \"./StorageException\";\nimport type { IStorage } from \"./types\";\n\ntype BunnyRegion = \"de\" | \"uk\" | \"ny\" | \"la\" | \"sg\" | \"se\" | \"br\" | \"jh\" | \"syd\";\n\ninterface BunnyFileInfo {\n Guid: string;\n StorageZoneName: string;\n Path: string;\n ObjectName: string;\n Length: number;\n LastChanged: string;\n ServerId: number;\n ArrayNumber: number;\n IsDirectory: boolean;\n UserId: string;\n ContentType: string;\n DateCreated: string;\n StorageZoneId: number;\n Checksum: string | null;\n ReplicatedZones: string | null;\n}\n\nexport class BunnyStorage implements IStorage {\n private bucket = \"\";\n private readonly accessKey: string;\n private readonly storageZone: string;\n private readonly region: BunnyRegion;\n\n constructor(options?: {\n accessKey?: string;\n storageZone?: string;\n region?: BunnyRegion;\n }) {\n const accessKey = options?.accessKey ?? Bun.env.STORAGE_BUNNY_ACCESS_KEY;\n const storageZone = options?.storageZone ?? Bun.env.STORAGE_BUNNY_STORAGE_ZONE;\n const region = options?.region ?? (Bun.env.STORAGE_BUNNY_REGION as BunnyRegion | undefined);\n\n if (!accessKey) {\n throw new StorageException(\n \"Bunny access key is required. Please provide an access key either through the constructor options or set the STORAGE_BUNNY_ACCESS_KEY environment variable.\",\n );\n }\n if (!storageZone) {\n throw new StorageException(\n \"Bunny storage zone is required. Please provide a storage zone either through the constructor options or set the STORAGE_BUNNY_STORAGE_ZONE environment variable.\",\n );\n }\n\n this.accessKey = accessKey;\n this.storageZone = storageZone;\n this.region = region ?? \"de\";\n }\n\n public setBucket(name: string): this {\n this.bucket = name;\n\n return this;\n }\n\n public async list(): Promise<string[]> {\n const path = this.bucket ? `${this.bucket}/` : \"\";\n const url = `${this.getBaseUrl()}/${this.storageZone}/${path}`;\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n AccessKey: this.accessKey,\n accept: \"application/json\",\n },\n });\n\n if (!response.ok) {\n throw new StorageException(`Failed to list files: ${response.status} ${response.statusText}`, {\n status: response.status,\n path,\n });\n }\n\n const files: BunnyFileInfo[] = await response.json();\n\n return files.filter((file) => !file.IsDirectory).map((file) => file.ObjectName);\n }\n\n public async clearBucket(): Promise<this> {\n const keys = await this.list();\n\n for (const key of keys) {\n await this.delete(key);\n }\n\n return this;\n }\n\n public async exists(key: string): Promise<boolean> {\n const url = this.buildFileUrl(key);\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n AccessKey: this.accessKey,\n },\n });\n\n return response.ok;\n }\n\n public async delete(key: string): Promise<void> {\n const url = this.buildFileUrl(key);\n\n const response = await fetch(url, {\n method: \"DELETE\",\n headers: {\n AccessKey: this.accessKey,\n },\n });\n\n if (!response.ok && response.status !== 404) {\n throw new StorageException(`Failed to delete file: ${response.status} ${response.statusText}`, {\n status: response.status,\n key,\n });\n }\n }\n\n public async putFile(key: string, localPath: string): Promise<number> {\n const file = Bun.file(localPath);\n\n return await this.put(key, file);\n }\n\n public async put(\n key: string,\n content: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer | Request | Response | BunFile | S3File | Blob,\n ): Promise<number> {\n const url = this.buildFileUrl(key);\n\n let body: BodyInit;\n let contentLength: number;\n\n if (typeof content === \"string\") {\n body = content;\n contentLength = new TextEncoder().encode(content).length;\n } else if (content instanceof ArrayBuffer) {\n body = new Blob([content]);\n contentLength = content.byteLength;\n } else if (content instanceof SharedArrayBuffer) {\n const uint8Array = new Uint8Array(content);\n const copiedArray = new Uint8Array(uint8Array.length);\n copiedArray.set(uint8Array);\n body = new Blob([copiedArray]);\n contentLength = content.byteLength;\n } else if (ArrayBuffer.isView(content)) {\n const arrayBuffer = content.buffer.slice(\n content.byteOffset,\n content.byteOffset + content.byteLength,\n ) as ArrayBuffer;\n body = new Blob([arrayBuffer]);\n contentLength = content.byteLength;\n } else if (content instanceof Blob) {\n body = content;\n contentLength = content.size;\n } else if (content instanceof Request || content instanceof Response) {\n const arrayBuffer = await content.arrayBuffer();\n body = new Blob([arrayBuffer]);\n contentLength = arrayBuffer.byteLength;\n } else if (typeof content === \"object\" && content !== null && \"arrayBuffer\" in content) {\n const fileContent = content as BunFile | S3File;\n const arrayBuffer = await fileContent.arrayBuffer();\n body = new Blob([arrayBuffer]);\n contentLength = arrayBuffer.byteLength;\n } else {\n throw new StorageException(\"Unsupported content type for upload\", { key });\n }\n\n const response = await fetch(url, {\n method: \"PUT\",\n headers: {\n AccessKey: this.accessKey,\n \"Content-Type\": \"application/octet-stream\",\n },\n body,\n });\n\n if (!response.ok) {\n throw new StorageException(`Failed to upload file: ${response.status} ${response.statusText}`, {\n status: response.status,\n key,\n });\n }\n\n return contentLength;\n }\n\n public async getAsJson<T = unknown>(key: string): Promise<T> {\n const url = this.buildFileUrl(key);\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n AccessKey: this.accessKey,\n },\n });\n\n if (!response.ok) {\n throw new StorageException(`Failed to get file as JSON: ${response.status} ${response.statusText}`, {\n status: response.status,\n key,\n });\n }\n\n return await response.json();\n }\n\n public async getAsArrayBuffer(key: string): Promise<ArrayBuffer> {\n const url = this.buildFileUrl(key);\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n AccessKey: this.accessKey,\n },\n });\n\n if (!response.ok) {\n throw new StorageException(`Failed to get file as ArrayBuffer: ${response.status} ${response.statusText}`, {\n status: response.status,\n key,\n });\n }\n\n return await response.arrayBuffer();\n }\n\n public getAsStream(key: string): ReadableStream {\n const url = this.buildFileUrl(key);\n\n const stream = new ReadableStream({\n start: async (controller) => {\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n AccessKey: this.accessKey,\n },\n });\n\n if (!response.ok) {\n controller.error(\n new StorageException(`Failed to get file as stream: ${response.status} ${response.statusText}`, {\n status: response.status,\n key,\n }),\n );\n return;\n }\n\n if (!response.body) {\n controller.error(new StorageException(\"Response body is null\", { key }));\n return;\n }\n\n const reader = response.body.getReader();\n\n const pump = async (): Promise<void> => {\n const { done, value } = await reader.read();\n\n if (done) {\n controller.close();\n return;\n }\n\n controller.enqueue(value);\n await pump();\n };\n\n await pump();\n },\n });\n\n return stream;\n }\n\n private getBaseUrl(): string {\n const regionEndpoints: Record<BunnyRegion, string> = {\n de: \"storage.bunnycdn.com\",\n uk: \"uk.storage.bunnycdn.com\",\n ny: \"ny.storage.bunnycdn.com\",\n la: \"la.storage.bunnycdn.com\",\n sg: \"sg.storage.bunnycdn.com\",\n se: \"se.storage.bunnycdn.com\",\n br: \"br.storage.bunnycdn.com\",\n jh: \"jh.storage.bunnycdn.com\",\n syd: \"syd.storage.bunnycdn.com\",\n };\n\n return `https://${regionEndpoints[this.region]}`;\n }\n\n private buildFileUrl(key: string): string {\n const path = this.bucket ? `${this.bucket}/${key}` : key;\n\n return `${this.getBaseUrl()}/${this.storageZone}/${path}`;\n }\n}\n",
8
- "import type { S3Options } from \"bun\";\nimport { AbstractStorage } from \"./AbstractStorage\";\nimport { StorageException } from \"./StorageException\";\n\nexport class CloudflareStorage extends AbstractStorage {\n protected bucket: string;\n private readonly accessKey: string;\n private readonly secretKey: string;\n private readonly endpoint: string;\n private readonly region: string;\n\n constructor(options?: {\n accessKey?: string;\n secretKey?: string;\n endpoint?: string;\n region?: \"EEUR\" | \"WEUR\" | \"APAC\" | \"NAM\";\n }) {\n super();\n\n const accessKey = options?.accessKey || Bun.env.STORAGE_CLOUDFLARE_ACCESS_KEY;\n const secretKey = options?.secretKey || Bun.env.STORAGE_CLOUDFLARE_SECRET_KEY;\n const endpoint = options?.endpoint || Bun.env.STORAGE_CLOUDFLARE_ENDPOINT;\n\n if (!accessKey) {\n throw new StorageException(\n \"Cloudflare access key is required. Please provide an access key either through the constructor options or set the STORAGE_CLOUDFLARE_ACCESS_KEY environment variable.\",\n );\n }\n if (!secretKey) {\n throw new StorageException(\n \"Cloudflare secret key is required. Please provide a secret key either through the constructor options or set the STORAGE_CLOUDFLARE_SECRET_KEY environment variable.\",\n );\n }\n if (!endpoint) {\n throw new StorageException(\n \"Cloudflare endpoint is required. Please provide an endpoint either through the constructor options or set the STORAGE_CLOUDFLARE_ENDPOINT environment variable.\",\n );\n }\n\n this.accessKey = accessKey;\n this.secretKey = secretKey;\n this.endpoint = endpoint;\n this.region = options?.region || Bun.env.STORAGE_CLOUDFLARE_REGION || \"EEUR\";\n }\n\n public getOptions(): S3Options {\n return {\n accessKeyId: this.accessKey,\n secretAccessKey: this.secretKey,\n endpoint: this.endpoint,\n bucket: this.bucket,\n region: this.region,\n };\n }\n}\n",
9
6
  "import { container, EContainerScope } from \"@ooneex/container\";\nimport type { StorageClassType } from \"./types\";\n\nexport const decorator = {\n storage: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: StorageClassType): void => {\n container.add(target, scope);\n };\n },\n};\n",
10
- "import { existsSync, mkdirSync } from \"node:fs\";\nimport { mkdir, readdir, rmdir, stat } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport type { BunFile, S3File, S3Options } from \"bun\";\nimport { AbstractStorage } from \"./AbstractStorage\";\nimport { StorageException } from \"./StorageException\";\n\nexport class FilesystemStorage extends AbstractStorage {\n protected bucket: string;\n private readonly storagePath: string;\n\n constructor(options?: {\n storagePath?: string;\n }) {\n super();\n\n const basePath = options?.storagePath || Bun.env.FILESYSTEM_STORAGE_PATH;\n\n if (!basePath) {\n throw new StorageException(\n \"Base path is required. Please provide a base path either through the constructor options or set the FILESYSTEM_STORAGE_PATH environment variable.\",\n );\n }\n\n this.storagePath = basePath;\n\n try {\n if (!existsSync(basePath)) {\n mkdirSync(basePath, { recursive: true });\n }\n } catch (error) {\n throw new StorageException(\n `Failed to create base storage directory at ${basePath}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n public getOptions(): S3Options {\n return {\n accessKeyId: \"filesystem\",\n secretAccessKey: \"filesystem\",\n endpoint: this.storagePath,\n bucket: this.bucket,\n region: \"local\",\n };\n }\n\n private getBucketPath(): string {\n if (!this.bucket) {\n throw new StorageException(\"Bucket name is required. Please call setBucket() first.\");\n }\n return join(this.storagePath, this.bucket);\n }\n\n private getFilePath(key: string): string {\n return join(this.getBucketPath(), key);\n }\n\n public override setBucket(name: string): this {\n this.bucket = name;\n\n const bucketPath = this.getBucketPath();\n try {\n if (!existsSync(bucketPath)) {\n mkdirSync(bucketPath, { recursive: true });\n }\n } catch (error) {\n throw new StorageException(\n `Failed to create bucket directory at ${bucketPath}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n return this;\n }\n\n public override async list(): Promise<string[]> {\n const bucketPath = this.getBucketPath();\n\n if (!existsSync(bucketPath)) {\n return [];\n }\n\n try {\n const files = await this.listFilesRecursive(bucketPath, bucketPath);\n return files;\n } catch (error) {\n throw new StorageException(\n `Failed to list files in bucket: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n private async listFilesRecursive(dir: string, baseDir: string): Promise<string[]> {\n const files: string[] = [];\n const entries = await readdir(dir);\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n const stats = await stat(fullPath);\n\n if (stats.isDirectory()) {\n const subFiles = await this.listFilesRecursive(fullPath, baseDir);\n files.push(...subFiles);\n } else {\n const relativePath = fullPath.substring(baseDir.length + 1);\n files.push(relativePath);\n }\n }\n\n return files;\n }\n\n public override async clearBucket(): Promise<this> {\n const bucketPath = this.getBucketPath();\n\n if (!existsSync(bucketPath)) {\n return this;\n }\n\n try {\n await this.removeDirectoryRecursive(bucketPath);\n await mkdir(bucketPath, { recursive: true });\n } catch (error) {\n throw new StorageException(`Failed to clear bucket: ${error instanceof Error ? error.message : String(error)}`);\n }\n\n return this;\n }\n\n private async removeDirectoryRecursive(dir: string): Promise<void> {\n const entries = await readdir(dir);\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n const stats = await stat(fullPath);\n\n if (stats.isDirectory()) {\n await this.removeDirectoryRecursive(fullPath);\n await rmdir(fullPath);\n } else {\n const file = Bun.file(fullPath);\n await file.delete();\n }\n }\n }\n\n public override async exists(key: string): Promise<boolean> {\n const filePath = this.getFilePath(key);\n const file = Bun.file(filePath);\n return await file.exists();\n }\n\n public override async delete(key: string): Promise<void> {\n const filePath = this.getFilePath(key);\n const file = Bun.file(filePath);\n\n if (!(await file.exists())) {\n return;\n }\n\n try {\n await file.delete();\n\n let parentDir = dirname(filePath);\n const bucketPath = this.getBucketPath();\n\n while (parentDir !== bucketPath && parentDir !== this.storagePath) {\n try {\n const entries = await readdir(parentDir);\n if (entries.length === 0) {\n await rmdir(parentDir);\n parentDir = dirname(parentDir);\n } else {\n break;\n }\n } catch {\n break;\n }\n }\n } catch (error) {\n throw new StorageException(\n `Failed to delete file ${key}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n public override async putFile(key: string, localPath: string): Promise<number> {\n const file = Bun.file(localPath);\n return await this.put(key, file);\n }\n\n public override async put(\n key: string,\n content: string | ArrayBuffer | SharedArrayBuffer | Request | Response | BunFile | S3File | Blob,\n ): Promise<number> {\n const filePath = this.getFilePath(key);\n const dir = dirname(filePath);\n\n try {\n if (!existsSync(dir)) {\n await mkdir(dir, { recursive: true });\n }\n } catch (error) {\n throw new StorageException(\n `Failed to create directory ${dir}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n try {\n let bytesWritten: number;\n\n if (typeof content === \"string\") {\n bytesWritten = await Bun.write(filePath, content);\n } else if (content instanceof ArrayBuffer) {\n bytesWritten = await Bun.write(filePath, content);\n } else if (content instanceof SharedArrayBuffer) {\n const arrayBuffer = new ArrayBuffer(content.byteLength);\n new Uint8Array(arrayBuffer).set(new Uint8Array(content));\n bytesWritten = await Bun.write(filePath, arrayBuffer);\n } else if (content instanceof Request) {\n const arrayBuffer = await content.arrayBuffer();\n bytesWritten = await Bun.write(filePath, arrayBuffer);\n } else if (content instanceof Response) {\n const arrayBuffer = await content.arrayBuffer();\n bytesWritten = await Bun.write(filePath, arrayBuffer);\n } else if (content instanceof Blob) {\n bytesWritten = await Bun.write(filePath, content);\n } else {\n const arrayBuffer = await (content as BunFile | S3File).arrayBuffer();\n bytesWritten = await Bun.write(filePath, arrayBuffer);\n }\n\n return bytesWritten;\n } catch (error) {\n throw new StorageException(\n `Failed to write file ${key}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n public override async getAsJson<T>(key: string): Promise<T> {\n const filePath = this.getFilePath(key);\n const file = Bun.file(filePath);\n\n if (!(await file.exists())) {\n throw new StorageException(`File ${key} does not exist`);\n }\n\n try {\n return await file.json();\n } catch (error) {\n throw new StorageException(\n `Failed to read file ${key} as JSON: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n public override async getAsArrayBuffer(key: string): Promise<ArrayBuffer> {\n const filePath = this.getFilePath(key);\n const file = Bun.file(filePath);\n\n if (!(await file.exists())) {\n throw new StorageException(`File ${key} does not exist`);\n }\n\n try {\n return await file.arrayBuffer();\n } catch (error) {\n throw new StorageException(\n `Failed to read file ${key} as ArrayBuffer: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n public override getAsStream(key: string): ReadableStream {\n const filePath = this.getFilePath(key);\n\n if (!existsSync(filePath)) {\n throw new StorageException(`File ${key} does not exist`);\n }\n\n const file = Bun.file(filePath);\n\n try {\n return file.stream();\n } catch (error) {\n throw new StorageException(\n `Failed to read file ${key} as stream: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n}\n"
7
+ "import { Exception } from \"@ooneex/exception\";\nimport { HttpStatus } from \"@ooneex/http-status\";\n\nexport class StorageException extends Exception {\n constructor(message: string, data: Record<string, unknown> = {}) {\n super(message, {\n status: HttpStatus.Code.InternalServerError,\n data,\n });\n this.name = \"StorageException\";\n }\n}\n",
8
+ "import type { BunFile, S3File } from \"bun\";\nimport { decorator } from \"./decorators\";\nimport { StorageException } from \"./StorageException\";\nimport type { IStorage } from \"./types\";\n\ntype BunnyRegion = \"de\" | \"uk\" | \"ny\" | \"la\" | \"sg\" | \"se\" | \"br\" | \"jh\" | \"syd\";\n\ninterface BunnyFileInfo {\n Guid: string;\n StorageZoneName: string;\n Path: string;\n ObjectName: string;\n Length: number;\n LastChanged: string;\n ServerId: number;\n ArrayNumber: number;\n IsDirectory: boolean;\n UserId: string;\n ContentType: string;\n DateCreated: string;\n StorageZoneId: number;\n Checksum: string | null;\n ReplicatedZones: string | null;\n}\n\n@decorator.storage()\nexport class BunnyStorage implements IStorage {\n private bucket = \"\";\n private readonly accessKey: string;\n private readonly storageZone: string;\n private readonly region: BunnyRegion;\n\n constructor(options?: {\n accessKey?: string;\n storageZone?: string;\n region?: BunnyRegion;\n }) {\n const accessKey = options?.accessKey ?? Bun.env.STORAGE_BUNNY_ACCESS_KEY;\n const storageZone = options?.storageZone ?? Bun.env.STORAGE_BUNNY_STORAGE_ZONE;\n const region = options?.region ?? (Bun.env.STORAGE_BUNNY_REGION as BunnyRegion | undefined);\n\n if (!accessKey) {\n throw new StorageException(\n \"Bunny access key is required. Please provide an access key either through the constructor options or set the STORAGE_BUNNY_ACCESS_KEY environment variable.\",\n );\n }\n if (!storageZone) {\n throw new StorageException(\n \"Bunny storage zone is required. Please provide a storage zone either through the constructor options or set the STORAGE_BUNNY_STORAGE_ZONE environment variable.\",\n );\n }\n\n this.accessKey = accessKey;\n this.storageZone = storageZone;\n this.region = region ?? \"de\";\n }\n\n public setBucket(name: string): this {\n this.bucket = name;\n\n return this;\n }\n\n public async list(): Promise<string[]> {\n const path = this.bucket ? `${this.bucket}/` : \"\";\n const url = `${this.getBaseUrl()}/${this.storageZone}/${path}`;\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n AccessKey: this.accessKey,\n accept: \"application/json\",\n },\n });\n\n if (!response.ok) {\n throw new StorageException(`Failed to list files: ${response.status} ${response.statusText}`, {\n status: response.status,\n path,\n });\n }\n\n const files: BunnyFileInfo[] = await response.json();\n\n return files.filter((file) => !file.IsDirectory).map((file) => file.ObjectName);\n }\n\n public async clearBucket(): Promise<this> {\n const keys = await this.list();\n\n for (const key of keys) {\n await this.delete(key);\n }\n\n return this;\n }\n\n public async exists(key: string): Promise<boolean> {\n const url = this.buildFileUrl(key);\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n AccessKey: this.accessKey,\n },\n });\n\n return response.ok;\n }\n\n public async delete(key: string): Promise<void> {\n const url = this.buildFileUrl(key);\n\n const response = await fetch(url, {\n method: \"DELETE\",\n headers: {\n AccessKey: this.accessKey,\n },\n });\n\n if (!response.ok && response.status !== 404) {\n throw new StorageException(`Failed to delete file: ${response.status} ${response.statusText}`, {\n status: response.status,\n key,\n });\n }\n }\n\n public async putFile(key: string, localPath: string): Promise<number> {\n const file = Bun.file(localPath);\n\n return await this.put(key, file);\n }\n\n public async put(\n key: string,\n content: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer | Request | Response | BunFile | S3File | Blob,\n ): Promise<number> {\n const url = this.buildFileUrl(key);\n\n let body: BodyInit;\n let contentLength: number;\n\n if (typeof content === \"string\") {\n body = content;\n contentLength = new TextEncoder().encode(content).length;\n } else if (content instanceof ArrayBuffer) {\n body = new Blob([content]);\n contentLength = content.byteLength;\n } else if (content instanceof SharedArrayBuffer) {\n const uint8Array = new Uint8Array(content);\n const copiedArray = new Uint8Array(uint8Array.length);\n copiedArray.set(uint8Array);\n body = new Blob([copiedArray]);\n contentLength = content.byteLength;\n } else if (ArrayBuffer.isView(content)) {\n const arrayBuffer = content.buffer.slice(\n content.byteOffset,\n content.byteOffset + content.byteLength,\n ) as ArrayBuffer;\n body = new Blob([arrayBuffer]);\n contentLength = content.byteLength;\n } else if (content instanceof Blob) {\n body = content;\n contentLength = content.size;\n } else if (content instanceof Request || content instanceof Response) {\n const arrayBuffer = await content.arrayBuffer();\n body = new Blob([arrayBuffer]);\n contentLength = arrayBuffer.byteLength;\n } else if (typeof content === \"object\" && content !== null && \"arrayBuffer\" in content) {\n const fileContent = content as BunFile | S3File;\n const arrayBuffer = await fileContent.arrayBuffer();\n body = new Blob([arrayBuffer]);\n contentLength = arrayBuffer.byteLength;\n } else {\n throw new StorageException(\"Unsupported content type for upload\", { key });\n }\n\n const response = await fetch(url, {\n method: \"PUT\",\n headers: {\n AccessKey: this.accessKey,\n \"Content-Type\": \"application/octet-stream\",\n },\n body,\n });\n\n if (!response.ok) {\n throw new StorageException(`Failed to upload file: ${response.status} ${response.statusText}`, {\n status: response.status,\n key,\n });\n }\n\n return contentLength;\n }\n\n public async getAsJson<T = unknown>(key: string): Promise<T> {\n const url = this.buildFileUrl(key);\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n AccessKey: this.accessKey,\n },\n });\n\n if (!response.ok) {\n throw new StorageException(`Failed to get file as JSON: ${response.status} ${response.statusText}`, {\n status: response.status,\n key,\n });\n }\n\n return await response.json();\n }\n\n public async getAsArrayBuffer(key: string): Promise<ArrayBuffer> {\n const url = this.buildFileUrl(key);\n\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n AccessKey: this.accessKey,\n },\n });\n\n if (!response.ok) {\n throw new StorageException(`Failed to get file as ArrayBuffer: ${response.status} ${response.statusText}`, {\n status: response.status,\n key,\n });\n }\n\n return await response.arrayBuffer();\n }\n\n public getAsStream(key: string): ReadableStream {\n const url = this.buildFileUrl(key);\n\n const stream = new ReadableStream({\n start: async (controller) => {\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n AccessKey: this.accessKey,\n },\n });\n\n if (!response.ok) {\n controller.error(\n new StorageException(`Failed to get file as stream: ${response.status} ${response.statusText}`, {\n status: response.status,\n key,\n }),\n );\n return;\n }\n\n if (!response.body) {\n controller.error(new StorageException(\"Response body is null\", { key }));\n return;\n }\n\n const reader = response.body.getReader();\n\n const pump = async (): Promise<void> => {\n const { done, value } = await reader.read();\n\n if (done) {\n controller.close();\n return;\n }\n\n controller.enqueue(value);\n await pump();\n };\n\n await pump();\n },\n });\n\n return stream;\n }\n\n private getBaseUrl(): string {\n const regionEndpoints: Record<BunnyRegion, string> = {\n de: \"storage.bunnycdn.com\",\n uk: \"uk.storage.bunnycdn.com\",\n ny: \"ny.storage.bunnycdn.com\",\n la: \"la.storage.bunnycdn.com\",\n sg: \"sg.storage.bunnycdn.com\",\n se: \"se.storage.bunnycdn.com\",\n br: \"br.storage.bunnycdn.com\",\n jh: \"jh.storage.bunnycdn.com\",\n syd: \"syd.storage.bunnycdn.com\",\n };\n\n return `https://${regionEndpoints[this.region]}`;\n }\n\n private buildFileUrl(key: string): string {\n const path = this.bucket ? `${this.bucket}/${key}` : key;\n\n return `${this.getBaseUrl()}/${this.storageZone}/${path}`;\n }\n}\n",
9
+ "import type { S3Options } from \"bun\";\nimport { AbstractStorage } from \"./AbstractStorage\";\nimport { decorator } from \"./decorators\";\nimport { StorageException } from \"./StorageException\";\n\n@decorator.storage()\nexport class CloudflareStorage extends AbstractStorage {\n protected bucket: string;\n private readonly accessKey: string;\n private readonly secretKey: string;\n private readonly endpoint: string;\n private readonly region: string;\n\n constructor(options?: {\n accessKey?: string;\n secretKey?: string;\n endpoint?: string;\n region?: \"EEUR\" | \"WEUR\" | \"APAC\" | \"NAM\";\n }) {\n super();\n\n const accessKey = options?.accessKey || Bun.env.STORAGE_CLOUDFLARE_ACCESS_KEY;\n const secretKey = options?.secretKey || Bun.env.STORAGE_CLOUDFLARE_SECRET_KEY;\n const endpoint = options?.endpoint || Bun.env.STORAGE_CLOUDFLARE_ENDPOINT;\n\n if (!accessKey) {\n throw new StorageException(\n \"Cloudflare access key is required. Please provide an access key either through the constructor options or set the STORAGE_CLOUDFLARE_ACCESS_KEY environment variable.\",\n );\n }\n if (!secretKey) {\n throw new StorageException(\n \"Cloudflare secret key is required. Please provide a secret key either through the constructor options or set the STORAGE_CLOUDFLARE_SECRET_KEY environment variable.\",\n );\n }\n if (!endpoint) {\n throw new StorageException(\n \"Cloudflare endpoint is required. Please provide an endpoint either through the constructor options or set the STORAGE_CLOUDFLARE_ENDPOINT environment variable.\",\n );\n }\n\n this.accessKey = accessKey;\n this.secretKey = secretKey;\n this.endpoint = endpoint;\n this.region = options?.region || Bun.env.STORAGE_CLOUDFLARE_REGION || \"EEUR\";\n }\n\n public getOptions(): S3Options {\n return {\n accessKeyId: this.accessKey,\n secretAccessKey: this.secretKey,\n endpoint: this.endpoint,\n bucket: this.bucket,\n region: this.region,\n };\n }\n}\n",
10
+ "import { existsSync, mkdirSync } from \"node:fs\";\nimport { mkdir, readdir, rmdir, stat } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport type { BunFile, S3File, S3Options } from \"bun\";\nimport { AbstractStorage } from \"./AbstractStorage\";\nimport { decorator } from \"./decorators\";\nimport { StorageException } from \"./StorageException\";\n\n@decorator.storage()\nexport class FilesystemStorage extends AbstractStorage {\n protected bucket: string;\n private readonly storagePath: string;\n\n constructor(options?: {\n storagePath?: string;\n }) {\n super();\n\n const basePath = options?.storagePath || Bun.env.FILESYSTEM_STORAGE_PATH;\n\n if (!basePath) {\n throw new StorageException(\n \"Base path is required. Please provide a base path either through the constructor options or set the FILESYSTEM_STORAGE_PATH environment variable.\",\n );\n }\n\n this.storagePath = basePath;\n\n try {\n if (!existsSync(basePath)) {\n mkdirSync(basePath, { recursive: true });\n }\n } catch (error) {\n throw new StorageException(\n `Failed to create base storage directory at ${basePath}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n public getOptions(): S3Options {\n return {\n accessKeyId: \"filesystem\",\n secretAccessKey: \"filesystem\",\n endpoint: this.storagePath,\n bucket: this.bucket,\n region: \"local\",\n };\n }\n\n private getBucketPath(): string {\n if (!this.bucket) {\n throw new StorageException(\"Bucket name is required. Please call setBucket() first.\");\n }\n return join(this.storagePath, this.bucket);\n }\n\n private getFilePath(key: string): string {\n return join(this.getBucketPath(), key);\n }\n\n public override setBucket(name: string): this {\n this.bucket = name;\n\n const bucketPath = this.getBucketPath();\n try {\n if (!existsSync(bucketPath)) {\n mkdirSync(bucketPath, { recursive: true });\n }\n } catch (error) {\n throw new StorageException(\n `Failed to create bucket directory at ${bucketPath}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n return this;\n }\n\n public override async list(): Promise<string[]> {\n const bucketPath = this.getBucketPath();\n\n if (!existsSync(bucketPath)) {\n return [];\n }\n\n try {\n const files = await this.listFilesRecursive(bucketPath, bucketPath);\n return files;\n } catch (error) {\n throw new StorageException(\n `Failed to list files in bucket: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n private async listFilesRecursive(dir: string, baseDir: string): Promise<string[]> {\n const files: string[] = [];\n const entries = await readdir(dir);\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n const stats = await stat(fullPath);\n\n if (stats.isDirectory()) {\n const subFiles = await this.listFilesRecursive(fullPath, baseDir);\n files.push(...subFiles);\n } else {\n const relativePath = fullPath.substring(baseDir.length + 1);\n files.push(relativePath);\n }\n }\n\n return files;\n }\n\n public override async clearBucket(): Promise<this> {\n const bucketPath = this.getBucketPath();\n\n if (!existsSync(bucketPath)) {\n return this;\n }\n\n try {\n await this.removeDirectoryRecursive(bucketPath);\n await mkdir(bucketPath, { recursive: true });\n } catch (error) {\n throw new StorageException(`Failed to clear bucket: ${error instanceof Error ? error.message : String(error)}`);\n }\n\n return this;\n }\n\n private async removeDirectoryRecursive(dir: string): Promise<void> {\n const entries = await readdir(dir);\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n const stats = await stat(fullPath);\n\n if (stats.isDirectory()) {\n await this.removeDirectoryRecursive(fullPath);\n await rmdir(fullPath);\n } else {\n const file = Bun.file(fullPath);\n await file.delete();\n }\n }\n }\n\n public override async exists(key: string): Promise<boolean> {\n const filePath = this.getFilePath(key);\n const file = Bun.file(filePath);\n return await file.exists();\n }\n\n public override async delete(key: string): Promise<void> {\n const filePath = this.getFilePath(key);\n const file = Bun.file(filePath);\n\n if (!(await file.exists())) {\n return;\n }\n\n try {\n await file.delete();\n\n let parentDir = dirname(filePath);\n const bucketPath = this.getBucketPath();\n\n while (parentDir !== bucketPath && parentDir !== this.storagePath) {\n try {\n const entries = await readdir(parentDir);\n if (entries.length === 0) {\n await rmdir(parentDir);\n parentDir = dirname(parentDir);\n } else {\n break;\n }\n } catch {\n break;\n }\n }\n } catch (error) {\n throw new StorageException(\n `Failed to delete file ${key}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n public override async putFile(key: string, localPath: string): Promise<number> {\n const file = Bun.file(localPath);\n return await this.put(key, file);\n }\n\n public override async put(\n key: string,\n content: string | ArrayBuffer | SharedArrayBuffer | Request | Response | BunFile | S3File | Blob,\n ): Promise<number> {\n const filePath = this.getFilePath(key);\n const dir = dirname(filePath);\n\n try {\n if (!existsSync(dir)) {\n await mkdir(dir, { recursive: true });\n }\n } catch (error) {\n throw new StorageException(\n `Failed to create directory ${dir}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n try {\n let bytesWritten: number;\n\n if (typeof content === \"string\") {\n bytesWritten = await Bun.write(filePath, content);\n } else if (content instanceof ArrayBuffer) {\n bytesWritten = await Bun.write(filePath, content);\n } else if (content instanceof SharedArrayBuffer) {\n const arrayBuffer = new ArrayBuffer(content.byteLength);\n new Uint8Array(arrayBuffer).set(new Uint8Array(content));\n bytesWritten = await Bun.write(filePath, arrayBuffer);\n } else if (content instanceof Request) {\n const arrayBuffer = await content.arrayBuffer();\n bytesWritten = await Bun.write(filePath, arrayBuffer);\n } else if (content instanceof Response) {\n const arrayBuffer = await content.arrayBuffer();\n bytesWritten = await Bun.write(filePath, arrayBuffer);\n } else if (content instanceof Blob) {\n bytesWritten = await Bun.write(filePath, content);\n } else {\n const arrayBuffer = await (content as BunFile | S3File).arrayBuffer();\n bytesWritten = await Bun.write(filePath, arrayBuffer);\n }\n\n return bytesWritten;\n } catch (error) {\n throw new StorageException(\n `Failed to write file ${key}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n public override async getAsJson<T>(key: string): Promise<T> {\n const filePath = this.getFilePath(key);\n const file = Bun.file(filePath);\n\n if (!(await file.exists())) {\n throw new StorageException(`File ${key} does not exist`);\n }\n\n try {\n return await file.json();\n } catch (error) {\n throw new StorageException(\n `Failed to read file ${key} as JSON: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n public override async getAsArrayBuffer(key: string): Promise<ArrayBuffer> {\n const filePath = this.getFilePath(key);\n const file = Bun.file(filePath);\n\n if (!(await file.exists())) {\n throw new StorageException(`File ${key} does not exist`);\n }\n\n try {\n return await file.arrayBuffer();\n } catch (error) {\n throw new StorageException(\n `Failed to read file ${key} as ArrayBuffer: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n public override getAsStream(key: string): ReadableStream {\n const filePath = this.getFilePath(key);\n\n if (!existsSync(filePath)) {\n throw new StorageException(`File ${key} does not exist`);\n }\n\n const file = Bun.file(filePath);\n\n try {\n return file.stream();\n } catch (error) {\n throw new StorageException(\n `Failed to read file ${key} as stream: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n}\n"
11
11
  ],
12
- "mappings": ";AAGO,MAAe,CAAoC,CAC9C,OAA8B,KAIjC,SAAS,CAAC,EAAoB,CAInC,OAHA,KAAK,OAAS,EACd,KAAK,OAAS,IAAI,IAAI,SAAS,KAAK,WAAW,CAAC,EAEzC,UAGI,KAAI,EAAsB,C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+1,7 @@
1
1
  {
2
2
  "name": "@ooneex/storage",
3
3
  "description": "File and object storage abstraction layer with support for local filesystem and cloud storage providers",
4
- "version": "0.0.12",
4
+ "version": "0.0.14",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -28,9 +28,9 @@
28
28
  "npm:publish": "bun publish --tolerate-republish --access public"
29
29
  },
30
30
  "dependencies": {
31
- "@ooneex/container": "0.0.12",
32
- "@ooneex/exception": "0.0.11",
33
- "@ooneex/http-status": "0.0.11"
31
+ "@ooneex/container": "0.0.14",
32
+ "@ooneex/exception": "0.0.13",
33
+ "@ooneex/http-status": "0.0.13"
34
34
  },
35
35
  "keywords": [
36
36
  "blob",