Skip to content

Commit ec2ae10

Browse files
committed
feat: add expiration parameter to getPresignedUrl function
1 parent d20a81e commit ec2ae10

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/features/s3/presignUrl/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import { parseUrl } from "@aws-sdk/url-parser";
44
import { Hash } from "@aws-sdk/hash-node";
55
import { formatUrl } from "@aws-sdk/util-format-url";
66

7-
export const getPresignedUrl = async (url: string): Promise<string> => {
8-
const expirationSeconds = 1200; // 20 minutes
7+
// default expiration is 20 minutes (1200 seconds)
8+
export const getPresignedUrl = async (
9+
url: string,
10+
expirationSeconds: number = 1200
11+
): Promise<string> => {
912
const s3ObjectUrl = parseUrl(url);
1013
const presigner = new S3RequestPresigner({
1114
credentials: {

0 commit comments

Comments
 (0)