Skip to content

Commit

Permalink
converting webp to png
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeaux committed Sep 17, 2020
1 parent eca2e3b commit 2a34cc1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/uploading/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a34cc1

Please sign in to comment.