/provider/cloudfront
The cloudfront provider module exports a method to fetch resources from an AWS cloudfront service.
- Source
Requires
- module:fs
- module:path
- module:/utils/logger
- module:@aws-sdk/cloudfront-signer
Methods
(async, inner) cloudfront(ref) → {Promise.<(String|JSON|Buffer|Error)>}
The method creates a signed URL for a cloudfront resource, fetches the resource and returns the fetched resource.
A buffer is returned with the ref.params.buffer flag.
JSON is returned if the URL path matches the .json file ending to fetch a JSON resource from the cloudfront service.
The fetch response will be parsed as text by default.
Parameters:
PropertiesName | Type | Description |
---|---|---|
ref | Object | | Reference object or URL string. |
Name | Type | Attributes | Description |
---|---|---|---|
ref.params | Object | <optional> | Optional parameters for the request. |
params.url | string | <optional> | Cloudfront resource URL. |
params.signedURL | boolean | <optional> | Return a signedURL only. |
params.buffer | boolean | <optional> | Return a buffer from the fetch. |
Returns:
The method resolves to either JSON, Text, or Buffer dependent ref.params.
- Type:
- Promise.<(String|JSON|Buffer|Error)>