UNPKG

2.32 kBTypeScriptView Raw
1import { GetUrlInput, GetUrlOutput, GetUrlWithPathInput, GetUrlWithPathOutput } from '../types';
2/**
3 * Get a temporary presigned URL to download the specified S3 object.
4 * The presigned URL expires when the associated role used to sign the request expires or
5 * the option `expiresIn` is reached. The `expiresAt` property in the output object indicates when the URL MAY expire.
6 *
7 * By default, it will not validate the object that exists in S3. If you set the `options.validateObjectExistence`
8 * to true, this method will verify the given object already exists in S3 before returning a presigned
9 * URL, and will throw `StorageError` if the object does not exist.
10 *
11 * @param input - The `GetUrlWithPathInput` object.
12 * @returns Presigned URL and timestamp when the URL may expire.
13 * @throws service: `S3Exception` - thrown when checking for existence of the object
14 * @throws validation: `StorageValidationErrorCode` - Validation errors
15 * thrown either username or key are not defined.
16 *
17 */
18export declare function getUrl(input: GetUrlWithPathInput): Promise<GetUrlWithPathOutput>;
19/**
20 * @deprecated The `key` and `accessLevel` parameters are deprecated and may be removed in the next major version.
21 * Please use {@link https://docs.amplify.aws/javascript/build-a-backend/storage/download/#generate-a-download-url | path} instead.
22 *
23 * Get a temporary presigned URL to download the specified S3 object.
24 * The presigned URL expires when the associated role used to sign the request expires or
25 * the option `expiresIn` is reached. The `expiresAt` property in the output object indicates when the URL MAY expire.
26 *
27 * By default, it will not validate the object that exists in S3. If you set the `options.validateObjectExistence`
28 * to true, this method will verify the given object already exists in S3 before returning a presigned
29 * URL, and will throw `StorageError` if the object does not exist.
30 *
31 * @param input - The `GetUrlInput` object.
32 * @returns Presigned URL and timestamp when the URL may expire.
33 * @throws service: `S3Exception` - thrown when checking for existence of the object
34 * @throws validation: `StorageValidationErrorCode` - Validation errors
35 * thrown either username or key are not defined.
36 *
37 */
38export declare function getUrl(input: GetUrlInput): Promise<GetUrlOutput>;