diff --git a/lib/uploading/importer.js b/lib/uploading/importer.js index 28efaecd..5fec7237 100644 --- a/lib/uploading/importer.js +++ b/lib/uploading/importer.js @@ -39,6 +39,22 @@ async function downloadAndSaveThumbnails(thumbnailUrl, uniqueTag, channelUrl, ex await fs.writeFileAsync(thumbnailDestination, thumbnail.body, 'binary'); + const fileTypeData = await FileType.fromFile(thumbnailDestination); + + const realExtension = fileTypeData.ext; + + const mime = fileTypeData.mime; + + if(realExtension == 'webp'){ + + const newDestination = `uploads/${channelUrl}/${uniqueTag}-custom.png`; + + const result = await webp.dwebp(thumbnailDestination, newDestination, "-o"); + + console.log(result); + console.log('ITS A WEBP') + } + // TODO: test : is this webp? // if so, have to convert that file to png via that libary