Skip to content

Commit

Permalink
Merge pull request #1188 from dbauszus-glx/cloudfront-buffer
Browse files Browse the repository at this point in the history
Provide buffer param for cloudfront provider
  • Loading branch information
RobAndrewHurst authored Mar 21, 2024
2 parents 49023ba + 4d04e45 commit 5edbce1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mod/provider/cloudfront.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const { getSignedUrl } = require('@aws-sdk/cloudfront-signer');

const logger = require('../utils/logger')

const nodeFetch = require('node-fetch')

module.exports = async ref => {

try {
Expand All @@ -34,14 +36,16 @@ module.exports = async ref => {
return signedURL;
}

const response = await fetch(signedURL)
const response = await nodeFetch(signedURL)

logger(`${response.status} - ${url}`,'cloudfront')

if (response.status >= 300) return new Error(`${response.status} ${ref}`)

if (url.match(/\.json$/i)) return await response.json()

if (ref.params.buffer) return await response.buffer()

return await response.text()

} catch(err) {
Expand Down

0 comments on commit 5edbce1

Please sign in to comment.