-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
68 lines (68 loc) · 2.43 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
declare module "amazon-s3-uri" {
export = AmazonS3URI;
/**
* A URI wrapper that can parse out information about an S3 URI
*
* @example <caption>instanciate AmazonS3URI</caption>
* try {
* const uri = 'https://bucket.s3-aws-region.amazonaws.com/key'
* const { region, bucket, key } = new AmazonS3URI(uri)
* } catch (err) {
* console.warn(`${uri} is not a valid S3 uri`) // should not happen because `uri` is valid in that example
* }
* @example <caption>functional interface: it automatically returns an AmazonS3URI instance</caption>
* const { region, bucket, key } = AmazonS3URI(uri)
* @param {string} uri - the URI to parse
* @throws {TypeError|Error}
*/
function AmazonS3URI(uri: string): AmazonS3URI;
class AmazonS3URI {
/**
* A URI wrapper that can parse out information about an S3 URI
*
* @example <caption>instanciate AmazonS3URI</caption>
* try {
* const uri = 'https://bucket.s3-aws-region.amazonaws.com/key'
* const { region, bucket, key } = new AmazonS3URI(uri)
* } catch (err) {
* console.warn(`${uri} is not a valid S3 uri`) // should not happen because `uri` is valid in that example
* }
* @example <caption>functional interface: it automatically returns an AmazonS3URI instance</caption>
* const { region, bucket, key } = AmazonS3URI(uri)
* @param {string} uri - the URI to parse
* @throws {TypeError|Error}
*/
constructor(uri: string);
/**
* URL object from `url.parse`
* @type { URL }
* */
uri: URL;
/**
* the bucket name parsed from the URI (or null if no bucket specified)
* @type { string | null }
* */
bucket: string | null;
/**
* the region parsed from the URI (or `DEFAULT_REGION`)
* @type { string }
* */
region: string;
/**
* the key parsed from the URI (or null if no key specified)
* @type {string | null}
* */
key: string | null;
/**
* true if the URI contains the bucket in the path,
* false if it contains the bucket in the authority
* @type { boolean }
* */
isPathStyle: boolean;
/**
* @constant
* @default 'us-east-1'
*/
DEFAULT_REGION: string;
}
}