@hdriel/aws-utils 1.1.1 → 1.1.2
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 +8 -2
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1516,7 +1516,11 @@ var S3Stream = class _S3Stream extends S3File {
|
|
|
1516
1516
|
}
|
|
1517
1517
|
// todo: LOCALSTACK SANITY CHECKED - WORKING WELL, DON'T TOUCH!
|
|
1518
1518
|
getStreamFileCtrl(_0) {
|
|
1519
|
-
return __async(this, arguments, function* ({
|
|
1519
|
+
return __async(this, arguments, function* ({
|
|
1520
|
+
filePath,
|
|
1521
|
+
filename,
|
|
1522
|
+
forDownloading = false
|
|
1523
|
+
}) {
|
|
1520
1524
|
return (req, res, next) => __async(this, null, function* () {
|
|
1521
1525
|
var _a2, _b;
|
|
1522
1526
|
const abort = new AbortController();
|
|
@@ -1548,7 +1552,9 @@ var S3Stream = class _S3Stream extends S3File {
|
|
|
1548
1552
|
const fileInfo = yield this.fileInfo(normalizedKey);
|
|
1549
1553
|
const fileName = filename || normalizedKey.split("/").pop() || "download";
|
|
1550
1554
|
res.setHeader("Content-Type", fileInfo.ContentType || "application/octet-stream");
|
|
1551
|
-
|
|
1555
|
+
if (forDownloading) {
|
|
1556
|
+
res.setHeader("Content-Disposition", `attachment; filename="${fileName}"`);
|
|
1557
|
+
}
|
|
1552
1558
|
if (fileInfo.ContentLength) {
|
|
1553
1559
|
res.setHeader("Content-Length", String(fileInfo.ContentLength));
|
|
1554
1560
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -320,9 +320,10 @@ declare class S3Stream extends S3File {
|
|
|
320
320
|
queryField?: string;
|
|
321
321
|
cachingAge?: number;
|
|
322
322
|
}) => (req: Request$1 & any, res: Response & any, next: NextFunction & any) => Promise<void>;
|
|
323
|
-
getStreamFileCtrl({ filePath, filename }: {
|
|
323
|
+
getStreamFileCtrl({ filePath, filename, forDownloading, }: {
|
|
324
324
|
filePath: string;
|
|
325
325
|
filename?: string;
|
|
326
|
+
forDownloading?: boolean;
|
|
326
327
|
}): Promise<(req: Request$1 & any, res: Response & any, next: NextFunction & any) => Promise<void>>;
|
|
327
328
|
getStreamZipFileCtr({ filePath, filename: _filename, compressionLevel, }: {
|
|
328
329
|
filePath: string | string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -320,9 +320,10 @@ declare class S3Stream extends S3File {
|
|
|
320
320
|
queryField?: string;
|
|
321
321
|
cachingAge?: number;
|
|
322
322
|
}) => (req: Request$1 & any, res: Response & any, next: NextFunction & any) => Promise<void>;
|
|
323
|
-
getStreamFileCtrl({ filePath, filename }: {
|
|
323
|
+
getStreamFileCtrl({ filePath, filename, forDownloading, }: {
|
|
324
324
|
filePath: string;
|
|
325
325
|
filename?: string;
|
|
326
|
+
forDownloading?: boolean;
|
|
326
327
|
}): Promise<(req: Request$1 & any, res: Response & any, next: NextFunction & any) => Promise<void>>;
|
|
327
328
|
getStreamZipFileCtr({ filePath, filename: _filename, compressionLevel, }: {
|
|
328
329
|
filePath: string | string[];
|
package/dist/index.js
CHANGED
|
@@ -1505,7 +1505,11 @@ var S3Stream = class _S3Stream extends S3File {
|
|
|
1505
1505
|
}
|
|
1506
1506
|
// todo: LOCALSTACK SANITY CHECKED - WORKING WELL, DON'T TOUCH!
|
|
1507
1507
|
getStreamFileCtrl(_0) {
|
|
1508
|
-
return __async(this, arguments, function* ({
|
|
1508
|
+
return __async(this, arguments, function* ({
|
|
1509
|
+
filePath,
|
|
1510
|
+
filename,
|
|
1511
|
+
forDownloading = false
|
|
1512
|
+
}) {
|
|
1509
1513
|
return (req, res, next) => __async(this, null, function* () {
|
|
1510
1514
|
var _a2, _b;
|
|
1511
1515
|
const abort = new AbortController();
|
|
@@ -1537,7 +1541,9 @@ var S3Stream = class _S3Stream extends S3File {
|
|
|
1537
1541
|
const fileInfo = yield this.fileInfo(normalizedKey);
|
|
1538
1542
|
const fileName = filename || normalizedKey.split("/").pop() || "download";
|
|
1539
1543
|
res.setHeader("Content-Type", fileInfo.ContentType || "application/octet-stream");
|
|
1540
|
-
|
|
1544
|
+
if (forDownloading) {
|
|
1545
|
+
res.setHeader("Content-Disposition", `attachment; filename="${fileName}"`);
|
|
1546
|
+
}
|
|
1541
1547
|
if (fileInfo.ContentLength) {
|
|
1542
1548
|
res.setHeader("Content-Length", String(fileInfo.ContentLength));
|
|
1543
1549
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hdriel/aws-utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Simplified AWS SDK (v3) utilities for S3 (upload, download, streaming) with TypeScript support",
|
|
5
5
|
"author": "Hadriel Benjo (https://github.com/hdriel)",
|
|
6
6
|
"type": "module",
|