Open linen1996 opened 4 years ago
I directly run cwebp.exe like this bat code, it works, but the JavaScript code webpConverter.cwebp(input, output, options, callback), it got error Error! Unknown option '-'.
webpConverter.cwebp(input, output, options, callback)
Error! Unknown option '-'
:: bat code D:\Workspaces\front-end\project\image2html\node_modules\webp-converter/lib/libwebp_win64/bin/cwebp.exe -q 75 "D:/Workspaces/front-end/project/image2html/images/4 - 28172-1565573276-704911963.png" -o "D:/Workspaces/front-end/project/image2html/images/imagemin/4 - 28172-1565573276-704911963.webp"
// JavaScript code let imageDirPath = 'D:/Workspaces/front-end/project/image2html/images' let imageminRelativeFolder = 'imagemin' function getImageminDir (dirPath) { return `${imageDirPath}/${imageminRelativeFolder}` } function toWebp (file) { let input = `"${imageDirPath}/${file}"` let output = `"${getImageminDir()}/${util.replaceExtnameToWebp(file)}"` let options = `-q 75` let callback = function (status, error) { if (status == 101) { console.log('101, error) } } webpConverter.cwebp(input, output, options, callback) }
I directly run cwebp.exe like this bat code, it works, but the JavaScript code
webpConverter.cwebp(input, output, options, callback)
, it got errorError! Unknown option '-'
.