-
-
Save richardgrantserverless/7bfd084c970b361e80a60cd0bb13eeb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async resize(size, path) { | |
try { | |
... | |
const Bucket = process.env.BUCKET | |
const streamResize = sharp() | |
.resize(width, height) | |
.toFormat('png') | |
const readStream = s3Handler.readStream({ Bucket, Key }) | |
const { writeStream, uploaded } = s3Handler.writeStream({ Bucket, Key: newKey }) | |
readStream | |
.pipe(streamResize) | |
.pipe(writeStream) | |
await uploaded | |
return newKey | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment