File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -144,12 +144,16 @@ export class R2 {
144144 * Get a signed URL for serving an object from R2.
145145 *
146146 * @param key - The R2 object key.
147+ * @param options - Optional config object.
148+ * - `expiresIn` - The number of seconds until the URL expires (default: 3600, max: 604800 for 7 days).
147149 * @returns A promise that resolves to a signed URL for the object.
148150 */
149- async getUrl ( key : string ) {
151+ async getUrl ( key : string , options : { expiresIn ?: number } = { } ) {
152+ const { expiresIn = 3600 } = options ;
150153 return await getSignedUrl (
151154 this . r2 ,
152- new GetObjectCommand ( { Bucket : this . config . bucket , Key : key } )
155+ new GetObjectCommand ( { Bucket : this . config . bucket , Key : key } ) ,
156+ { expiresIn }
153157 ) ;
154158 }
155159 /**
You can’t perform that action at this time.
0 commit comments