Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function resize ({ input, distDir, sizes }) {
const inputFile = await Jimp.read(input)
await Promise.all(sizes.map(size => {
const distFile = path.join(distDir, `${size}.png`)
return new Promise(resolve => {
inputFile.clone().contain(size, size).write(distFile, () => resolve())
})
}))
}