Skip to content

Commit caea264

Browse files
committed
docs(storage): add comprehensive JSDoc documentation to GetSignedUrlConfig interface properties
1 parent 6b9fd1a commit caea264

1 file changed

Lines changed: 83 additions & 4 deletions

File tree

handwritten/storage/src/file.ts

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,98 @@ export interface SignedPostPolicyV4Output {
151151

152152
export interface GetSignedUrlConfig
153153
extends Pick<SignerGetSignedUrlConfig, 'host' | 'signingEndpoint'> {
154+
/**
155+
* The date and time when the signed URL becomes active/usable.
156+
* Maps to the `X-Goog-Date` query parameter in V4 signed URLs.
157+
* If not specified, the current time is used by default. This is useful for pre-generating
158+
* URLs that are only valid starting at a future point in time, or for pinning a static date
159+
* to ensure consistent URL generation across identical calls (beneficial for caching).
160+
*/
161+
accessibleAt?: string | number | Date;
162+
163+
/**
164+
* The action/operation permitted by the signed URL.
165+
* Supported values are:
166+
* - `'read'`: Allows retrieving file data (HTTP GET method).
167+
* - `'write'`: Allows uploading or overwriting file data (HTTP PUT method).
168+
* - `'delete'`: Allows deleting the file (HTTP DELETE method).
169+
* - `'resumable'`: Allows starting or resuming a resumable upload (HTTP POST method).
170+
*/
154171
action: 'read' | 'write' | 'delete' | 'resumable';
155-
version?: 'v2' | 'v4';
156-
virtualHostedStyle?: boolean;
172+
173+
/**
174+
* The Custom Domain Name (CNAME) to use instead of the default GCS hostname.
175+
* If you have configured a custom domain for your bucket, specifying this option
176+
* will format the generated URL with your custom domain.
177+
*/
157178
cname?: string;
179+
180+
/**
181+
* The MD5 digest of the content as a base64-encoded string.
182+
* Required if you want to enforce integrity checking on upload. The client
183+
* must send the exact matching `Content-MD5` header when using the signed URL.
184+
*/
158185
contentMd5?: string;
186+
187+
/**
188+
* The expected MIME type (Content-Type) of the file.
189+
* Useful when using `'write'` or `'resumable'` actions to enforce that the client upload
190+
* carries a specific `Content-Type` header matching this value.
191+
*/
159192
contentType?: string;
193+
194+
/**
195+
* The expiration date/time when the signed URL will no longer be valid.
196+
* The value can be a JavaScript `Date` object, an epoch timestamp (number of milliseconds),
197+
* or a date string. The maximum validity period is 7 days for V4 signed URLs.
198+
*/
160199
expires: string | number | Date;
161-
accessibleAt?: string | number | Date;
200+
201+
/**
202+
* Custom HTTP extension headers to be included as signed headers in the signed URL.
203+
* Keys must be header names (e.g., `x-goog-meta-custom`) and values must be their expected values.
204+
* The user must send these exact headers when making the HTTP request using the signed URL.
205+
*/
162206
extensionHeaders?: http.OutgoingHttpHeaders;
207+
208+
/**
209+
* A convenience option to prompt the browser to save the downloaded file with a specific filename.
210+
* This is a friendly shortcut that automatically formats the `responseDisposition` parameter
211+
* under the hood to `attachment; filename="<filename>"`.
212+
*/
163213
promptSaveAs?: string;
214+
215+
/**
216+
* Additional query parameters to include in the signature and append to the final signed URL.
217+
*/
218+
queryParams?: Query;
219+
220+
/**
221+
* Overrides the `Content-Disposition` response header returned by GCS on download.
222+
* For example, setting this to `attachment; filename="new-name.png"` forces the browser
223+
* to download the file with the specified filename.
224+
*/
164225
responseDisposition?: string;
226+
227+
/**
228+
* Overrides the `Content-Type` response header returned by GCS on download.
229+
* Useful if you want GCS to serve a file with a specific MIME type when accessed
230+
* via this signed URL, overriding its stored metadata.
231+
*/
165232
responseType?: string;
166-
queryParams?: Query;
233+
234+
/**
235+
* The signature version to use when generating the signed URL.
236+
* - `'v4'`: Google's recommended SHA256-based signing mechanism (default).
237+
* - `'v2'`: The legacy SHA1-based signing mechanism.
238+
*/
239+
version?: 'v2' | 'v4';
240+
241+
/**
242+
* If true, uses virtual hosted-style URLs (e.g. `https://bucket-name.storage.googleapis.com/object-name`)
243+
* instead of path-style URLs (e.g. `https://storage.googleapis.com/bucket-name/object-name`).
244+
*/
245+
virtualHostedStyle?: boolean;
167246
}
168247

169248
export interface GetFileMetadataOptions {

0 commit comments

Comments
 (0)