img-webpify
Version:
A modern and robust Node.js library for converting images to and from the WebP format. This library is a wrapper around Google's pre-compiled cwebp, dwebp, gwebp, and webpmux command-line utilities.
24 lines (18 loc) • 935 B
JavaScript
const path = require('path');
//get os type then return path of respective platform library
const gifwebp=function() {
if (process.platform === 'darwin') {
return path.join(__dirname, "../", "/bin/libwebp_osx/bin/gif2webp");//return osx library path
}else if (process.platform === 'linux') {
return path.join(__dirname, "../", "/bin/libwebp_linux/bin/gif2webp");//return linux library path
}else if (process.platform === 'win32') {
if (process.arch === 'x64') {
return path.join(__dirname, "../", "\\bin\\libwebp_win64\\bin\\gif2webp.exe");//return windows 64bit library path
} else {
console.log('Unsupported platform:', process.platform, process.arch);//show unsupported platform message
}
} else {
console.log('Unsupported platform:', process.platform, process.arch);//show unsupported platform message
}
};
module.exports = gifwebp