Skip to content

Instantly share code, notes, and snippets.

@vilellaj
Created April 24, 2020 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vilellaj/245a4dade8fb27776e1bed57eef783ff to your computer and use it in GitHub Desktop.
Save vilellaj/245a4dade8fb27776e1bed57eef783ff to your computer and use it in GitHub Desktop.
const fs = require('fs');
const sharp = require('sharp');
fs.readdirSync('./images').forEach(file => {
const buff = fs.readFileSync(`./images/${file}`);
sharp(buff).toFile('images/output.webp', (err, info) => {
if (err)
console.error(err);
console.info(info);
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment