forked from mayeaux/nodetube
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
139 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const FileType = require('file-type'); | ||
const webp = require('webp-converter'); | ||
|
||
|
||
(async () => { | ||
const fileTypeData = await FileType.fromFile('hq1.jpg'); | ||
|
||
const extension = fileTypeData.ext; | ||
|
||
const mime = fileTypeData.mime; | ||
|
||
if(extension == 'webp'){ | ||
console.log('webp fo sho') | ||
} | ||
|
||
console.log(extension, mime); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// console.log(fileTypeData.ext); | ||
//=> {ext: 'png', mime: 'image/png'} | ||
}); | ||
|
||
|
||
async function main(){ | ||
const fileTypeData = await FileType.fromFile('hq2.png'); | ||
|
||
console.log(fileTypeData) | ||
} | ||
|
||
// main(); | ||
|
||
|
||
function convertFile(originalFile, convertedFile){ | ||
const result = webp.dwebp(originalFile, convertedFile, "-o"); | ||
|
||
result.then((response) => { | ||
console.log(response); | ||
}); | ||
} | ||
|
||
const originalFile = 'hq1.jpg'; | ||
const convertedFile = 'hq2.png'; | ||
|
||
module.exports = convertFile; | ||
|
||
// make sure convertedFile is .png | ||
// convertFile(originalFile, convertedFile); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters