Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. //INSTALL WEBP_CONTVERTER WITH NPM: npm install webp-converter
  2. //RUN WITH NODE.JS: node webp.js
  3.  
  4. var webp = require('webp-converter');
  5. var fs = require('fs');
  6.  
  7. fs.readdir('img', function(err, files) {
  8. files.forEach(file => {
  9. let fullname = file,
  10. shortname = file.substring(0, file.length - 4);
  11. webp.cwebp("img/" + fullname, "webp/" + shortname + ".webp", "-q 100", function(status, error) {
  12. console.log(status);
  13. });
  14. })
  15. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement