Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async readFile(bucketName: string, filePath: string): Promise {
const cmd = new S3C.ReadFile(bucketName, filePath)
cmd.mode = this.mode
return await cmd.execute() // TODO: figure out why this s3cmd has no error interface
}
async function loadJSONFile(key: string) {
const content = await new S3.ReadFile(config.bucket, key).execute()
if (content !== '') {
return JSON.parse(content)
} else {
throw new Error(`Item with id '${key}' does not exist`)
}
}