@quatrain/storage-s3 1.2.8 → 1.2.9

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.
@@ -261,7 +261,16 @@ class S3StorageAdapter extends storage_1.AbstractStorageAdapter {
261
261
  const readable = new node_stream_1.Readable();
262
262
  readable.push(buffer);
263
263
  readable.push(null);
264
- return readable.pipe(res);
264
+ if (typeof (res === null || res === void 0 ? void 0 : res.on) === 'function') {
265
+ return readable.pipe(res);
266
+ }
267
+ else if (typeof (res === null || res === void 0 ? void 0 : res.send) === 'function') {
268
+ return res.send(buffer);
269
+ }
270
+ else if (typeof (res === null || res === void 0 ? void 0 : res.write) === 'function' && typeof (res === null || res === void 0 ? void 0 : res.end) === 'function') {
271
+ res.write(buffer);
272
+ return res.end();
273
+ }
265
274
  });
266
275
  }
267
276
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/storage-s3",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Storage adapter for S3 compatible services",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@aws-sdk/client-s3": "^3.337.0",
35
35
  "@aws-sdk/s3-request-presigner": "^3.342.0",
36
- "@quatrain/storage": "^1.2.13",
36
+ "@quatrain/storage": "^1.2.14",
37
37
  "fs-extra": "^11.2.0"
38
38
  },
39
39
  "scripts": {
@@ -296,7 +296,14 @@ export class S3StorageAdapter extends AbstractStorageAdapter {
296
296
  readable.push(buffer)
297
297
  readable.push(null)
298
298
 
299
- return readable.pipe(res)
299
+ if (typeof res?.on === 'function') {
300
+ return readable.pipe(res)
301
+ } else if (typeof res?.send === 'function') {
302
+ return res.send(buffer)
303
+ } else if (typeof res?.write === 'function' && typeof res?.end === 'function') {
304
+ res.write(buffer)
305
+ return res.end()
306
+ }
300
307
  }
301
308
 
302
309
  /**