Fix inferred file name extension

This commit is contained in:
Jia Hao 2016-03-08 23:57:19 +08:00
parent 9a8c18d0a4
commit 3f6f632d51
1 changed files with 1 additions and 1 deletions

View File

@ -11,9 +11,9 @@ tmp.setGracefulCleanup();
* @param {inferIconCallback} callback
*/
function inferIconFromUrlToPath(targetUrl, outDir, callback) {
const outfilePath = path.join(outDir, '/icon.png');
pageIcon(targetUrl, {ext: 'png'})
.then(icon => {
const outfilePath = path.join(outDir, `/icon.${icon.ext}`);
fs.writeFile(outfilePath, icon.data, error => {
callback(error, outfilePath);
});