Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function initCosInstance({ SecretId, SecretKey, XCosSecurityToken, ...args }) {
const cosInstance = new COS({
SecretId,
SecretKey,
XCosSecurityToken,
...args
})
const keys = Object.keys(COS.prototype)
const noRetryKeys = ['getObject', 'putObject']
appendFunction({
target: cosInstance,
keys: noRetryKeys,
maxTryTime: 1
})
appendFunction({
target: cosInstance,
keys: keys.filter(key => !noRetryKeys.includes(key)),
maxTryTime: 3
})
return cosInstance
}